https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80067
Bug ID: 80067 Summary: ICE in fold_comparison with -fsanitize=undefined Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: vsevolod.livinskij at frtk dot ru CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Target Milestone: --- Created attachment 40984 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40984&action=edit Reproducer. GCC crashes with with -fsanitize=undefined option. Reproducer: extern signed char a; void foo () { 0 << ((647 > a) - 1); } Error: >$ g++ -fsanitize=undefined -c repr.cpp repr.cpp: In function ‘void foo()’: repr.cpp:3:24: internal compiler error: tree check: expected class ‘expression’, have ‘constant’ (integer_cst) in fold_comparison, at fold-const.c:8707 0 << ((647 > a) - 1); ^ 0x10100b7 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) /home/vsevolod/workspace/gcc-dev/trunk/gcc/tree.c:9867 0xa94317 expr_check(tree_node*, char const*, int, char const*) /home/vsevolod/workspace/gcc-dev/trunk/gcc/tree.h:3233 0xa94317 fold_comparison (...) GCC version: Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/vsevolod/workspace/gcc-dev/bin-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/vsevolod/workspace/gcc-dev/trunk/configure --prefix=/home/vsevolod/workspace/gcc-dev/bin-trunk Thread model: posix gcc version 7.0.1 20170315 (experimental) (GCC)