<AWT Dev> 8209520: Build fails when native code coverage is enabled

Leonid Mesnik leonid.mesnik at oracle.com
Thu Aug 23 20:51:12 UTC 2018


Hi

Could you please review following fix which fix code so gcc doesn't complain when JDK is build with enabled native code coverage.

webrev: http://cr.openjdk.java.net/~lmesnik/8209520/webrev.00/ <http://cr.openjdk.java.net/~lmesnik/8209520/webrev.00/>
bug: https://bugs.openjdk.java.net/browse/JDK-8209520 <https://bugs.openjdk.java.net/browse/JDK-8209520>

These warning appeared because of change optimization settings used for getting code coverage. 

1) src/hotspot/cpu/x86/macroAssembler_x86.cpp, src/hotspot/share/gc/shared/genCollectedHeap.cpp

gcc complained about uninitialized variables, like
* For target hotspot_variant-server_libjvm_objs_macroAssembler_x86.o:
/home/lmesnik/ws/jdk-8209520/open/src/hotspot/cpu/x86/macroAssembler_x86.cpp: In member function 'void ControlWord::print() const':
/home/lmesnik/ws/jdk-8209520/open/src/hotspot/cpu/x86/macroAssembler_x86.cpp:5769:11: error: 'pc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     printf("%04x  masks = %s, %s, %s", _value & 0xFFFF, f, rc, pc);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lmesnik/ws/jdk-8209520/open/src/hotspot/cpu/x86/macroAssembler_x86.cpp:5769:11: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]

So I just fixed codepath to show more explicitly that variables are initialized before usage. 


2) src/java.desktop/share/native/libsplashscreen/splashscreen_png.c:
The changes to prevent waning about clobbering in splashscreen_png.c are similar to fix in:
JDK-8080695 <https://bugs.openjdk.java.net/browse/JDK-8080695>splashscreen_png.c compile error with gcc 4.9.2


The another approach would be to fix build to ignore these warnings for code coverage build. While I think it makes build system even more complicated.
Leonid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20180823/4845c748/attachment.html>


More information about the awt-dev mailing list