RFR: 8187676: Disable harmless uninitialized warnings for two files
Erik Helin
erik.helin at oracle.com
Tue Sep 19 14:46:44 UTC 2017
On 09/19/2017 03:55 PM, Kim Barrett wrote:
>> On Sep 19, 2017, at 9:37 AM, Erik Helin <erik.helin at oracle.com> wrote:
>>
>> Hi all,
>>
>> with gcc 7.1.1 from Fedora 26 on x86-64 there are warnings about the potential usage of maybe uninitialized memory in src/hotspot/cpu/x86/assembler_x86.cpp and in src/hotspot/cpu/x86/interp_masm_x86.cpp.
>>
>> The problems arises from the class RelocationHolder in src/hotspot/share/code/relocInfo.hpp which has the private fields:
>> enum { _relocbuf_size = 5 };
>> void* _relocbuf[ _relocbuf_size ];
>>
>> and the default constructor for RelocationHolder does not initialize the elements of _relocbuf. I _think_ this is an optimization, RelocationHolder is used *a lot* and setting the elements of RelocationHolder::_relocbuf to NULL (or some other value) in the default constructor might result in a performance penalty. Have a look in build/linux-x86_64-normal-server-fastdebug/hotspot/variant-server/gensrc/adfiles and you will see that RelocationHolder is used all over the place :)
>>
>> AFAICS all users of RelocationHolder::_relocbuf take care to not use uninitialized memory, which means that this warning is wrong, so I suggest we disable the warning -Wmaybe-uninitialized for src/hotspot/cpu/x86/assembler_x86.cpp.
>
> Rahul Raghavan is working on a fix for JDK-8160404 that is likely relevant.
> I have a patch from him for preliminary review.
I had a look at https://bugs.openjdk.java.net/browse/JDK-8160404 and I'm
not sure that the patch ensures that the elements of _relocbuf are
initialized (could very well be, I'm not particularly familiar with this
code).
Since JDK-8160404 seems to be under development, maybe we should take in
this patch that disables the warnings and then the patch for JDK-8160404
can enable the warnings again (if possible)?
Thanks,
Erik
More information about the build-dev
mailing list