-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Clang can't build ROOT anymore due to a new added diagnostic about undefined behavior #11128
Copy link
Copy link
Closed
Labels
Description
- Checked for duplicates
When using clang trunk to build ROOT (main branch), it fails due to case value is not a constant expression
❯ clang --version
clang version 16.0.0 (https://github.com/llvm/llvm-project/ dde41c6c560b67165c7ac884815cd50fdce446f8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jun/opt/clang/bin
cmake commands:
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=YES \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
-GNinja ..
System info:
I have tried Ubuntu 22 and WSL (Ubuntu 20) and got the same results.
Error message:
FAILED: io/io/CMakeFiles/RIO.dir/src/TGenCollectionStreamer.cxx.o
/home/jun/opt/clang/bin/clang++ -I/home/jun/dev/root/io/io/inc -I/home/jun/dev/root/core/unix/inc -I/home/jun/dev/root/core/foundation/v7/inc -I/home/jun/dev/root/core/base/v7/inc -I/home/jun/dev/root/core/clingutils/inc -I/home/jun/dev/root/core/textinput/inc -I/home/jun/dev/root/core/thread/inc -I/home/jun/dev/root/core/zip/inc -I/home/jun/dev/root/core/rint/inc -I/home/jun/dev/root/core/clib/inc -I/home/jun/dev/root/core/meta/inc -I/home/jun/dev/root/core/gui/inc -I/home/jun/dev/root/core/cont/inc -I/home/jun/dev/root/core/foundation/inc -I/home/jun/dev/root/core/base/inc -I/home/jun/dev/root/Build/ginclude -I/home/jun/dev/root/core/clib/res -I/home/jun/dev/root/builtins -fcolor-diagnostics -std=c++14 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -pipe -Wall -W -Woverloaded-virtual -fsigned-char -pthread -g -fPIC -std=c++14 -MD -MT io/io/CMakeFiles/RIO.dir/src/TGenCollectionStreamer.cxx.o -MF io/io/CMakeFiles/RIO.dir/src/TGenCollectionStreamer.cxx.o.d -o io/io/CMakeFiles/RIO.dir/src/TGenCollectionStreamer.cxx.o -c /home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:392:18: error: case value is not a constant expression
case EProperty(kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:392:18: note: integer value 536870912 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:394:18: error: case value is not a constant expression
case EProperty(kIsPointer | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:394:18: note: integer value 4097 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:396:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:396:18: note: integer value 536875008 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:398:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISTSTRING | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:398:18: note: integer value 1073745921 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:445:18: error: case value is not a constant expression
case EProperty(kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:445:18: note: integer value 536870912 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:450:18: error: case value is not a constant expression
case EProperty(kIsPointer | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:450:18: note: integer value 4097 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:454:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:454:18: note: integer value 536875008 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:458:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISTSTRING | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:458:18: note: integer value 1073745921 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:867:18: error: case value is not a constant expression
case EProperty(kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:867:18: note: integer value 536870912 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:870:18: error: case value is not a constant expression
case EProperty(kIsPointer | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:870:18: note: integer value 4097 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:873:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISSTRING):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:873:18: note: integer value 536875008 is outside the valid range of values [0, 63] for this enumeration type
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:876:18: error: case value is not a constant expression
case EProperty(kIsPointer | kBIT_ISTSTRING | kIsClass):
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jun/dev/root/io/io/src/TGenCollectionStreamer.cxx:876:18: note: integer value 1073745921 is outside the valid range of values [0, 63] for this enumeration type
12 errors generated.
[4730/6768] Building CXX object io/io/CMakeFiles/RIO.dir/src/TBufferJSON.cxx.o
ninja: build stopped: subcommand failed.
In addition, I found that the last time I build ROOT using clang trunk (before version 16), it was fine. So I guess there're some changes in the upstream that trigger this failure. However, I'm not sure if is it a false positive of clang diagnostic or a potential bug in ROOT we haven't discovered yet.
Reactions are currently unavailable