JDK-8140091 : remove VMStructs cast_uint64_t workaround for GCC 4.1.1 bug
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-10-20
  • Updated: 2020-11-30
  • Resolved: 2015-10-23
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 8 JDK 9
8u281Fixed 9 b92Fixed
Related Reports
Blocks :  
Description
The workaround was added to fix:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724

New code added by JDK-8139170 breaks builds on 32-bit platforms:

/opt/jprt/T/P1/235039.cthaling/s/hotspot/src/share/vm/runtime/vmStructs.cpp:3102:30: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
   { name, cast_uint64_t(value) },
                              ^
/opt/jprt/T/P1/235039.cthaling/s/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp:86:3: note: in expansion of macro 'GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY'
   declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL)
   ^
/opt/jprt/T/P1/235039.cthaling/s/hotspot/src/share/vm/runtime/vmStructs.cpp:3340:3: note: in expansion of macro 'VM_LONG_CONSTANTS_CPU'
   VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
   ^

The reason is that cast_uint64_t takes a size_t as argument:

static inline uint64_t cast_uint64_t(size_t x)
{
  return x;
}

but the passed value is an unsigned 64-bit constant value:

#define CPU_AVX512VL UCONST64(0x100000000)

GCC bug 27724 is a serious bug and we should not build the JDK with that version.  I am proposing to remove the workaround and add a check in the Makefiles to not allow GCC 4.1.1 to build HotSpot.