[jdk11u-dev] RFR: 8324307: [11u] hotspot fails to build with GCC 12 and newer (non-static data member initializers)

Andrew John Hughes andrew at openjdk.org
Wed Feb 14 01:28:05 UTC 2024


On Mon, 12 Feb 2024 21:37:16 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> Removing the tag in the meantime
>
>> Hi @GoeLin ,
>> 
>> > @jmtd, if these initializers are not needed at all, shouldn't they be removed in the higher releases as well?
>> 
>> This is a really good question and I took some time to ponder my reply.
>> 
>> They are not needed from a computational POV because the relevant fields are all initialised in the object constructors in all cases. However, to know this I had to read through the class definition to be sure. I didn't write the original code but if I had I would have likely also preferred an explicit null initialisation in the member declaration, which makes clear the intent that we do not have uninitialised fields and do not risk reading from uninitialised fields. There's a chance the constructor could be altered later and an iniitialisation accidentally removed, or an alternative constructor added lacking the initialisation, etc.
>> 
>> I doubt that anyone would welcome a patch to remove the redundant initialisers in main, but I could propose one if you disagree. WDYT?
> 
> I would say this is the sort of change that belongs only in 11u and older, for compatibility reasons (old C/C++ standards, older compilers). The current code in 17u+ is fine with `-std=c++14`.
> 
> Incidentally, if we are fixing 11u to compile with GCC 12, should we not also enable a GHA build with GCC 12 in a separate PR so that it does not regress again?

> I'll re-label approval-request, a I doubt Goetz saw my comment (or yours @gnu-andrew )

I think #2451 needs to be re-labelled as well. I'm not a fan of removing these requests outside the process used by the approval/approve commands as it isn't clear what's going on from the PR.

-------------

PR Comment: https://git.openjdk.org/jdk11u-dev/pull/2470#issuecomment-1942946313


More information about the jdk-updates-dev mailing list