RFR: 8298006: Build failure by maybe-uninitialized error on Linux s390x GCC8

Phil Race prr at openjdk.org
Mon Dec 5 19:50:14 UTC 2022


On Mon, 5 Dec 2022 18:19:55 GMT, Phil Race <prr at openjdk.org> wrote:

>> I changed GCC toolchain from GCC6 to GCC8 on SLES12SP5 Linux s390x.
>> I could see following errors:
>> 
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c: In function 'allocateRasterArray':
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:2944:73: error: 'roff[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>                              (((*inP&rasterP->sppsm.maskArray[c]) >> roff[c])
>>                                                                      ~~~~^~~
>> 
>> 
>> According to error messages,
>> roff and loff may not be initialized.
>
> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c line 2919:
> 
>> 2917:     memset(roff, 0, sizeof(roff));
>> 2918: #endif
>> 2919: 
> 
> Of the various ways this could be fixed this is one of my least preferred.
> Either 
> 1) Disable the warning for this file for this toolchain + platform in the makefile, or
> 2) Zero it out for all platforms. There's no platform-specific logic here.
> Unless you think there's a compiler bug and these are all false positive in which case (1) is definitely the way to go.

I think it should be zeroed for all platforms. Its not easy to tell that these are all initialized before use.

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

PR: https://git.openjdk.org/jdk/pull/11475



More information about the client-libs-dev mailing list