Description: This test case derived from OpenMP test omp1/F2_2_9h.f90, involves nested parallel loops. The gfortran compiler currently aborts with an internal error for this code. > gfortran -v Using built-in specs. Target: x86_64-suse-linux Configured with: ../xt-gcc-4.2.0/configure --prefix=/opt/gcc/4.2.0/snos --disable-nls --libdir=/opt/gcc/4.2.0/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/4.2.0/snos/include/g++ --with-slibdir=/opt/gcc/4.2.0/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit x86_64-suse-linux Thread model: posix gcc version 4.2.0 20070514 (rpm:4) > cat bug2830.f90 ! Derived from OpenMP test omp1/F2_2_9h.f90 use omp_lib implicit none integer, parameter :: NT = 4 integer :: nThreads(NT) integer :: i, tmp = 1, itmp = 0 !$ call omp_set_dynamic(.false.) !$ call omp_set_num_threads(NT) do i = 1, NT nThreads(i) = 0 enddo !$omp parallel private(itmp) itmp = omp_get_thread_num() + 1 !$omp parallel firstprivate(tmp) tmp = tmp + omp_get_thread_num() + 1 !$omp atomic nThreads(itmp) = nThreads(itmp)+tmp !$omp end parallel !$omp end parallel print *, nThreads END > ftn -fopenmp -c bug2830.f90 /opt/xt-pe/2.1/bin/snos64/ftn: INFO: linux target is being used bug2830.f90: In function 'MAIN__': bug2830.f90:16: internal compiler error: in lookup_decl_in_outer_ctx, at omp-low.c:1508 Please submit a full bug report, with preprocessed source if appropriate. ------ Note: ftn is an alias for: /opt/gcc/4.2.0/bin/../snos/bin/gfortran -static -v -I/opt/xt-mpt/2.1/mpich2-64/GP/include -I/opt/xt-mpt/2.1/mpich2-64/GP/include -L/opt/xt-mpt/2.1/mpich2-64/GP/lib -I/opt/acml/3.6.1/gnu64/include -I/opt/xt-libsci/10.1.0/gnu/snos64/include -I/opt/xt-libsci/10.1.0/gnu/snos64/include/superlu -I/opt/xt-mpt/2.1/sma/P/include -L/opt/acml/3.6.1/gnu64/lib -L/opt/xt-libsci/10.1.0/gnu/snos64/lib -L/opt/xt-mpt/2.1/sma/P/lib -lmpichf90 -lsci -lacml -lsma -lmpichf90 -lmpich -lrt -D__CRAYXT_COMPUTE_LINUX_TARGET -D__TARGET_LINUX__ -fno-second-underscore -I/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/include -I/opt/xt-catamount/2.1/catamount/linux/include -I/opt/xt-service/2.1/include -L/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/lib/snos64 -L/opt/xt-pe/2.1/cnos/linux/64/lib -L/opt/xt-mpt/2.1/lib/snos64 -L/opt/xt-service/2.1/lib/snos64 -Wl,--start -lpct -lalpslli -lalpsutil -lportals -lpthread -Wl,--end -lgfortranbegin -lgfortran -lm
Work around for Fortran: - integer :: i, tmp = 1, itmp = 0 + integer :: i, tmp, itmp + tmp = 1; itmp = 0 Reduced C test case below. The problem is that itmp and tmp are static. #include <omp.h> int main() { int nthreads[4]; static int tmp, itmp; omp_set_num_threads (4); #pragma omp parallel private(itmp) { itmp = omp_get_thread_num (); #pragma omp parallel firstprivate(tmp) { tmp = (omp_get_thread_num () + tmp) + 1; } } }
Subject: Bug 32362 Author: jakub Date: Thu Jun 21 12:11:00 2007 New Revision: 125917 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125917 Log: PR middle-end/32362 * omp-low.c (lookup_decl_in_outer_ctx): Don't ICE if t is NULL, but decl is a global var, instead return decl. * gimplify.c (gimplify_adjust_omp_clauses_1): Add shared clauses even for is_global_var decls, if they are private in some outer context. * testsuite/libgomp.c/pr32362-1.c: New test. * testsuite/libgomp.c/pr32362-2.c: New test. * testsuite/libgomp.c/pr32362-3.c: New test. Added: trunk/libgomp/testsuite/libgomp.c/pr32362-1.c trunk/libgomp/testsuite/libgomp.c/pr32362-2.c trunk/libgomp/testsuite/libgomp.c/pr32362-3.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimplify.c trunk/gcc/omp-low.c trunk/libgomp/ChangeLog
Subject: Bug 32362 Author: jakub Date: Thu Jun 21 12:15:53 2007 New Revision: 125918 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125918 Log: PR middle-end/32362 * omp-low.c (lookup_decl_in_outer_ctx): Don't ICE if t is NULL, but decl is a global var, instead return decl. * gimplify.c (gimplify_adjust_omp_clauses_1): Add shared clauses even for is_global_var decls, if they are private in some outer context. * testsuite/libgomp.c/pr32362-1.c: New test. * testsuite/libgomp.c/pr32362-2.c: New test. * testsuite/libgomp.c/pr32362-3.c: New test. Added: branches/gcc-4_2-branch/libgomp/testsuite/libgomp.c/pr32362-1.c branches/gcc-4_2-branch/libgomp/testsuite/libgomp.c/pr32362-2.c branches/gcc-4_2-branch/libgomp/testsuite/libgomp.c/pr32362-3.c Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/gimplify.c branches/gcc-4_2-branch/gcc/omp-low.c branches/gcc-4_2-branch/libgomp/ChangeLog
Fixed.
*** Bug 32551 has been marked as a duplicate of this bug. ***