JDK-8236709 : struct SwitchRange in HS violates C++ One Definition Rule
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-01-07
  • Updated: 2022-06-27
  • Resolved: 2020-01-10
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 11 JDK 13 JDK 15
11.0.7Fixed 13.0.4Fixed 15 b06Fixed
Description
when  experimenting  with  gcc8  and   the -flto compiler flag I was running into these  warnings  in the c1  coding :
  
  
 /open_jdk/jdk_3/jdk/src/hotspot/share/c1/c1_LIRGenerator.hpp:50:7: warning: type 'struct SwitchRange' violates the C++ One Definition Rule [-Wodr]
 class SwitchRange: public CompilationResourceObj {
        ^
 /open_jdk/jdk_3/jdk/src/hotspot/share/opto/parse2.cpp:319: note: a different type is defined in another translation unit
 class SwitchRange : public StackObj {
   /usr/work/d040975/open_jdk/jdk_3/jdk/src/hotspot/share/c1/c1_LIRGenerator.hpp:52:7: note: the first difference of corresponding definitions is field '_low_key'
    int _low_key;
        ^
 /open_jdk/jdk_3/jdk/src/hotspot/share/opto/parse2.cpp:321: note: a field with different name is defined in another translation unit
    jint _lo;                     // inclusive lower limit

Comments
Fix request (13u): The original change applies cleanly, passes tier1 and tier2 tests.
03-06-2020

jdk11 fix request I would like to have the patch in jdk11 as well, because the issue is present there too. The patch applies cleanly.
05-02-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/fb0148b08619 User: mbaesken Date: 2020-01-10 08:01:29 +0000
10-01-2020