https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84136
Bug ID: 84136 Summary: Compilation aborted when woking with labels as values Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: udalovilia at yandex dot ru Target Milestone: --- Created attachment 43297 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43297&action=edit Minimal reproducible sample I used to play with labels as values (https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html) and discovered compiler error. Following code leads to compiler segfault when compiling with -O1, -O2 or -O3. Affected all versions from gcc5.0 to gcc7.3. I have tested on Mac OS (10.13.2) and Linux (3.18.19-24). void* a; void foo() { if ((a = &&l)) return; l:; } int main() { foo(); goto *a; return 0; } bash$ g++-7 -v -save-temps gcc-bug.cpp -O1 Using built-in specs. COLLECT_GCC=g++-7 COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/7.3.0/libexec/gcc/x86_64-apple-darwin17.3.0/7.3.0/lto-wrapper Target: x86_64-apple-darwin17.3.0 Configured with: ../configure --build=x86_64-apple-darwin17.3.0 --prefix=/usr/local/Cellar/gcc/7.3.0 --libdir=/usr/local/Cellar/gcc/7.3.0/lib/gcc/7 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-7 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 7.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls Thread model: posix gcc version 7.3.0 (Homebrew GCC 7.3.0) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-mmacosx-version-min=10.13.3' '-asm_macosx_version_min=10.13' '-shared-libgcc' '-mtune=core2' /usr/local/Cellar/gcc/7.3.0/libexec/gcc/x86_64-apple-darwin17.3.0/7.3.0/cc1plus -E -quiet -v -D__DYNAMIC__ gcc-bug.cpp -fPIC -mmacosx-version-min=10.13.3 -mtune=core2 -O1 -fpch-preprocess -o gcc-bug.ii ignoring nonexistent directory "/usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/../../../../../../x86_64-apple-darwin17.3.0/include" #include "..." search starts here: #include <...> search starts here: /usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/../../../../../../include/c++/7.3.0 /usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/../../../../../../include/c++/7.3.0/x86_64-apple-darwin17.3.0 /usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/../../../../../../include/c++/7.3.0/backward /usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/include /usr/local/include /usr/local/Cellar/gcc/7.3.0/include /usr/local/Cellar/gcc/7.3.0/lib/gcc/7/gcc/x86_64-apple-darwin17.3.0/7.3.0/include-fixed /usr/include /System/Library/Frameworks /Library/Frameworks End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-mmacosx-version-min=10.13.3' '-asm_macosx_version_min=10.13' '-shared-libgcc' '-mtune=core2' /usr/local/Cellar/gcc/7.3.0/libexec/gcc/x86_64-apple-darwin17.3.0/7.3.0/cc1plus -fpreprocessed gcc-bug.ii -fPIC -quiet -dumpbase gcc-bug.cpp -mmacosx-version-min=10.13.3 -mtune=core2 -auxbase gcc-bug -O1 -version -o gcc-bug.s GNU C++14 (Homebrew GCC 7.3.0) version 7.3.0 (x86_64-apple-darwin17.3.0) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.0, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++14 (Homebrew GCC 7.3.0) version 7.3.0 (x86_64-apple-darwin17.3.0) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.0, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: e842f18ce880f3211760ed17476e01db gcc-bug.cpp: In function 'int main()': gcc-bug.cpp:10:5: internal compiler error: in find_taken_edge_computed_goto, at tree-cfg.c:2254 int main() { ^~~~ gcc-bug.cpp:10:5: internal compiler error: Abort trap: 6 g++-7: internal compiler error: Abort trap: 6 (program cc1plus) It seems to be reproducible for all