JDK-8160354 : uninitialized value warning and VM crash are occurred with GCC 6
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-06-27
  • Updated: 2019-09-13
  • Resolved: 2017-11-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Resolved
Related Reports
Duplicate :  
Relates :  
Description
I encountered 2 compiler warnings and 2 VM crashes with GCC 6:

* Compiler warnings:
-----------
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/assembler_x86.cpp: In static member function 'static Address Address::make_raw(int, int, int, int, relocInfo::relocType)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/assembler_x86.cpp:203:12: error: '*((void*)& rspec +32)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return madr;
            ^~~~
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/assembler_x86.cpp:203:12: error: '*((void*)& rspec +24)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/assembler_x86.cpp:203:12: error: '*((void*)& rspec +16)' may be used uninitialized in this function [-Werror=maybe-uninitialized]

cc1plus: all warnings being treated as errors
-----------
Error #3: uninitialized value at interp_masm_x86.cpp

```
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp: In member function 'void InterpreterMacroAssembler::increment_mdp_data_at(Register, int, bool)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   Address data(mdp_in, constant);
           ^~~~
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[4]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp: In member function 'void InterpreterMacroAssembler::increment_mdp_data_at(Register, Register, int, bool)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1388:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   Address data(mdp_in, reg, Address::times_1, constant);
           ^~~~
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1388:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1388:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[4]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp: In member function 'void InterpreterMacroAssembler::profile_called_method(Register, Register, Register)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   Address data(mdp_in, constant);
           ^~~~
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[4]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp: In member function 'void InterpreterMacroAssembler::profile_virtual_call(Register, Register, Register, bool)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[4]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp: In member function 'void InterpreterMacroAssembler::profile_ret(Register, Register)':
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[3]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/home/ysuenaga/OpenJDK/hs/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp:1354:11: error: 'data.Address::_rspec.RelocationHolder::_relocbuf[4]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1plus: all warnings being treated as errors
-----------

* VM crash
  - hs_err_pid45139.log and replay_pid45139.log
  - hs_err_pid58985.log and replay_pid58985.log
Comments
Hi [~ysuenaga], [~thartmann], yes closing this JDK-8160354 as duplicate of JDK-8160404. Thanks.
28-11-2017

Yes, given that JDK-8160404 takes care of these issues. [~rraghavan], can you please verify?
28-11-2017

Can I close this ticket as duplicate of JDK-8160404 ?
28-11-2017

I think the proposed change to the RelocationHolder constructor may be just papering over the problems discussed in JDK-8160404, making it harder for the compiler to diagnose.
23-05-2017

Thanks Tobias, I posted review request: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2017-May/026306.html
23-05-2017

Yes, please send it to hotspot-compiler-dev@openjdk.java.net. You may also want to look at JDK-8160404 which seems to be related.
23-05-2017

Should I send review request for jdk 10 with this webrev? http://cr.openjdk.java.net/~ysuenaga/JDK-8160354/webrev.01/
23-05-2017

ILW = Build fails, with gcc 6, use alternate compiler = HLM = P3
23-05-2017

This change affects compiler code, moving to compiler subcomponent.
23-05-2017

You can avoid this warning if you add --with-extra-cflags='-Wno-maybe-uninitialized' to configure option. However, the cause of this warning is from uninitialized value. https://gcc.gnu.org/wiki/Better_Uninitialized_Warnings I think we should remove the usage of uninitialized value. I've uploaded a webrev for it. http://cr.openjdk.java.net/~ysuenaga/JDK-8160354/webrev.01/
30-08-2016

Is it possible to work around this issue by passing a compile flag to gcc via make/CFLAGS/configure?
30-08-2016

Priority: I = H - can't build; L = L - gcc 6 not in common use; W = M - using alternate compiler may not be easy if gcc 6 is part of distribution. HLM = P3
24-08-2016