struct SwitchRange and C++ One Definition Rule [-Wodr]
Baesken, Matthias
matthias.baesken at sap.com
Fri Jan 3 15:49:11 UTC 2020
Hello, 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
Do you think this should be fixed ( renaming one SwitchRange ) ?
Martin suggested that even without flto added it could be problematic .
Thanks, Matthias
More information about the hotspot-compiler-dev
mailing list