csmith-project / csmith

Csmith, a random generator of C programs
http://embed.cs.utah.edu/csmith/
Other
1.01k stars 144 forks source link

csmith compile error integer value 2 is outside the valid range of values [0, 1] for the enumeration type 'FilterKind' [-Wenum-constexpr-conversion] by llvm 17.0.6 #163

Open sendaoYan opened 7 months ago

sendaoYan commented 7 months ago

replay command:

git clone git@github.com:csmith-project/csmith.git
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ 
make

cd /tmp/tone/run/csmith/csmith/build/src
clang++ -DHAVE_CONFIG_H -I/tmp/tone/run/csmith/csmith/build -I/tmp/tone/run/csmith/csmith/src -Wall -Wextra -Wno-long-long -std=c++14 -MD -MT src/CMakeFiles/csmith.dir/AbsExtension.cpp.o -MF CMakeFiles/csmith.dir/AbsExtension.cpp.o.d -o CMakeFiles/csmith.dir/AbsExtension.cpp.o -c /tmp/tone/run/csmith/csmith/src/AbsExtension.cpp

result:

[ 10%] Building CXX object src/CMakeFiles/csmith.dir/AbsExtension.cpp.o
In file included from /tmp/tone/run/csmith/csmith/src/AbsExtension.cpp:37:
In file included from /tmp/tone/run/csmith/csmith/src/Type.h:48:
In file included from /tmp/tone/run/csmith/csmith/src/StatementAssign.h:37:
In file included from /tmp/tone/run/csmith/csmith/src/Statement.h:46:
In file included from /tmp/tone/run/csmith/csmith/src/Probabilities.h:37:
/tmp/tone/run/csmith/csmith/src/Filter.h:60:14: error: integer value 2 is outside the valid range of values [0, 1] for the enumeration type 'FilterKind' [-Wenum-constexpr-conversion]
   60 |         std::bitset<MAX_FILTER_KIND_SIZE> kinds_;
      |                     ^
/tmp/tone/run/csmith/csmith/src/Filter.h:40:31: note: expanded from macro 'MAX_FILTER_KIND_SIZE'
   40 | #define MAX_FILTER_KIND_SIZE ((FilterKind) (fDFS + 1))
      |                               ^
1 error generated.

clang version and env info:

# uname -a ; cat /etc/os-release ; free -h ; lscpu | head -n 15 ; clang -v 
Linux iZbp1gh4rfhfnynoaq5a57Z 5.10.134-16.1.al8.x86_64 #1 SMP Thu Dec 7 14:11:24 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
NAME="Alibaba Cloud Linux"
VERSION="3 (Soaring Falcon)"
ID="alinux"
ID_LIKE="rhel fedora centos anolis"
VERSION_ID="3"
UPDATE_ID="9"
PLATFORM_ID="platform:al8"
PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)"
ANSI_COLOR="0;31"
HOME_URL="https://www.aliyun.com/"

              total        used        free      shared  buff/cache   available
Mem:          243Gi       1.5Gi       186Gi       2.0Mi        55Gi       240Gi
Swap:            0B          0B          0B
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              128
On-line CPU(s) list: 0-127
Thread(s) per core:  2
Core(s) per socket:  32
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Alibaba Cloud
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
BIOS Model name:     pc-i440fx-2.1
clang version 17.0.6 (/home/yansendao/tone/run/csmith/llvm-project-17.0.6.src/clang 887ab9c49cb4b6f07b0d18908c2c955d3a6d0b98)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /tmp/tone/run/csmith/llvm-17.0.6-binary/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/10
Candidate multilib: .;@m64
Selected multilib: .;@m64