8228420: compile error in shenandoahSupport.cpp with clang 9

Baesken, Matthias matthias.baesken at sap.com
Fri Jul 19 07:46:18 UTC 2019


Hello,  on OSX  we recently run into this compile error (see below ).

We use clang 9 :  configure: Using clang C compiler version 9.0.0 [Apple LLVM version 9.0.0 (clang-900.0.39.2)


/nightly/jdk/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp:3019:33: error: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Werror,-Wparentheses]
  return Node::hash() + _native ? 1 : 0;
         ~~~~~~~~~~~~~~~~~~~~~~ ^
/nightly/jdk/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp:3019:33: note: place parentheses around the '+' expression to silence this warning
  return Node::hash() + _native ? 1 : 0;
                                ^
         (                     )


This might be related to  :

8227677: Shenandoah: C2: Make in-native LRB special case of normal LRB

I opened the bug :   https://bugs.openjdk.java.net/browse/JDK-8228420


Should we go for

return Node::hash() + ( _native ? 1 : 0 );

to please the compiler ?  Is the issue on present on more recent Xcode / clang versions   on OSX ?


Thanks, Matthias




More information about the hotspot-dev mailing list