https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86025
Bug ID: 86025 Summary: ICE with -Wduplicated-branches and OpenMP critical Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zed.three at gmail dot com Target Milestone: --- Created attachment 44221 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44221&action=edit Preprocessed output Compiling the following MVCE with "-Wduplicated-branches -fopenmp" causes an ICE. I've checked with 7.3.1 and 8.0.1. It's very similar to 79672, but with a different pragma. Dropping "(foo)" makes the ICE go away. #include <omp.h> void foo() { if (false) { #pragma omp parallel #pragma omp critical (foo) if (false) { } } } Output: Using built-in specs. COLLECT_GCC=g++-8 OFFLOAD_TARGET_NAMES=hsa:nvptx-none Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/8 --enable-ssp --disable-libssp --disable-libvtv --disable-cet --disable-libcc1 --enable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-8 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux Thread model: posix gcc version 8.0.1 20180425 (prerelease) [gcc-8-branch revision 259638] (SUSE Linux) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-Wduplicated-branches' '-fopenmp' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread' /usr/lib64/gcc/x86_64-suse-linux/8/cc1plus -E -quiet -v -D_GNU_SOURCE -D_REENTRANT gcc_crash.cxx -mtune=generic -march=x86-64 -Wduplicated-branches -fopenmp -fpch-preprocess -o gcc_crash.ii #include "..." search starts here: #include <...> search starts here: /usr/include/c++/8 /usr/include/c++/8/x86_64-suse-linux /usr/include/c++/8/backward /usr/lib64/gcc/x86_64-suse-linux/8/include /usr/local/include /usr/lib64/gcc/x86_64-suse-linux/8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/include /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-Wduplicated-branches' '-fopenmp' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread' /usr/lib64/gcc/x86_64-suse-linux/8/cc1plus -fpreprocessed gcc_crash.ii -quiet -dumpbase gcc_crash.cxx -mtune=generic -march=x86-64 -auxbase gcc_crash -Wduplicated-branches -version -fopenmp -o gcc_crash.s GNU C++14 (SUSE Linux) version 8.0.1 20180425 (prerelease) [gcc-8-branch revision 259638] (x86_64-suse-linux) compiled by GNU C version 8.0.1 20180425 (prerelease) [gcc-8-branch revision 259638], GMP version 6.1.2, MPFR version 4.0.1-p6, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++14 (SUSE Linux) version 8.0.1 20180425 (prerelease) [gcc-8-branch revision 259638] (x86_64-suse-linux) compiled by GNU C version 8.0.1 20180425 (prerelease) [gcc-8-branch revision 259638], GMP version 6.1.2, MPFR version 4.0.1-p6, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: ca1e18c23ccd29ea8279af847a2b27d0 gcc_crash.cxx: In function ‘void foo()’: gcc_crash.cxx:10:1: internal compiler error: in add_expr, at tree.c:7417 } ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.opensuse.org/> for instructions.