https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79940
Bug ID: 79940 Summary: OpenMP pragma - internal compiler error with taskloop Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: aidan.chalk at gmail dot com Target Milestone: --- Created attachment 40913 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40913&action=edit The .i file produced by the compiler for the bug desribed here. Using taskloop with an iterator declared prior to an OpenMP parallel region causes an internal compiler error: Compiled with: gcc-7 -fopenmp x.c >> gcc-7 -v Using built-in specs. COLLECT_GCC=gcc-7 COLLECT_LTO_WRAPPER=/opt/gcc/7.20160925/lib/gcc/x86_64-suse-linux/7.0.0/lto-wrapper Target: x86_64-suse-linux Configured with: ./configure --prefix=/opt/gcc/7.20160925 --with-pkgversion='openSUSE Linux' --enable-languages=c,c++,fortran --enable-checking=release --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --enable-plugin -with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --enable-linker-build-id --enable-linux-futex --program-suffix=-7 --without-system-libunwind --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux --enable-bootstrap --disable-multilib Thread model: posix gcc version 7.0.0 20160925 (experimental) (openSUSE Linux) I've attached the relevant .i file produced by 7.0. I have not checked if this occurs with gfortran at this time. This error can be avoided if removing the pragma omp parallel (which is apparently fixed in bug 71371, but without the parallel this is not a useful code). Also by replacing: for(i =0; i <.... with for(int i = 0; i < ...) the bug disappears, however both are OpenMP compliant. I've also found the identical bug when compiling with gcc 6.3 on a different machine: > gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/gpfs/stfc/local/apps/gcc/gcc/6.3.0/libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/gpfs/stfc/local/apps/gcc/gcc/6.3.0 --disable-multilib --with-system-zlib --disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --enable-offload-targets=x86_64-intelmic-linux=/gpfs/stfc/local/apps/mic/gcc/6.3.0 --enable-languages=c,c++,fortran,lto : (reconfigured) ../configure --prefix=/gpfs/stfc/local/apps/gcc/gcc/6.3.0 --disable-multilib --with-system-zlib --disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --enable-languages=c,c++,fortran,lto Thread model: posix gcc version 6.3.0 (GCC) > gcc -fopenmp main.c main.c: In function 'main': main.c:12:11: internal compiler error: in extract_omp_for_data, at omp-low.c:635 #pragma omp taskloop default(none) shared(a, b, c) private(i) ^~~ 0x925815 extract_omp_for_data ../../gcc/omp-low.c:635 0x94178e lower_omp_for ../../gcc/omp-low.c:15149 0x93834e lower_omp_1 ../../gcc/omp-low.c:17027 0x93834e lower_omp ../../gcc/omp-low.c:17164 0x93fc95 lower_omp_taskreg ../../gcc/omp-low.c:15650 0x938416 lower_omp_1 ../../gcc/omp-low.c:17020 0x938416 lower_omp ../../gcc/omp-low.c:17164 0x9380f0 lower_omp_1 ../../gcc/omp-low.c:17003 0x9380f0 lower_omp ../../gcc/omp-low.c:17164 0x9383a5 lower_omp_1 ../../gcc/omp-low.c:17012 0x9383a5 lower_omp ../../gcc/omp-low.c:17164 0x93c2ca execute_lower_omp ../../gcc/omp-low.c:17899 0x93c2ca execute ../../gcc/omp-low.c:17936