Using the parameter ONE in the PRIVATE stanza of the parallel do in the below code produces the shown error. This error only occurs if the subroutine is in a module file. user@host $ gfortran-4.3 -fopenmp -c test.f90 test.f90: In function ‘test’: test.f90:8: internal compiler error: in gfc_finish_var_decl, at fortran/trans-decl.c:510 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. user@host $ cat test.f90 module testmod implicit none real, parameter :: one = 1.0 contains subroutine test integer i real, dimension(4) :: a = (/ 1, 2, 3, 4 /) real, dimension(4) :: b !$OMP PARALLEL DO PRIVATE(I, ONE) do i = 1,size(a) b(i) = one*a(i) end do !$OMP END PARALLEL DO print *, "b = ", b end subroutine test end module user@host $ gfortran-4.3 -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --program-suffix=-4.3 Thread model: posix gcc version 4.3.0 (GCC)
Thanks for the report; the internal compiler error is definitely a compiler bug. However, I believe the program is invalid. If I read "2.8.3.3 private clause" in the OpenMP 2.5 specification correctly, the items in the private(list) need to variables which are definable or allocatable. However, "ONE" is not even a variable. Thus the program is invalid. However, an error message such as the one of sunf95 should be given instead of an ICE. sunf95 writes: !$OMP PARALLEL DO PRIVATE(I, ONE) ^ "dfff.f90", Line = 14, Column = 34: ERROR: Object ONE must be a variable to be in the PRIVATE clause of the PARALLEL DO directive. ifort writes: !$OMP PARALLEL DO PRIVATE(I, ONE) ---------------------------------^ fortcom: Error: dfff.f90, line 14: Subobjects are not allowed in this OpenMP clause; a named variable must be specified.
(In reply to comment #1) > Thanks for the report; the internal compiler error is definitely a compiler > bug. However, I believe the program is invalid. I know the program is invalid (thought that went without saying, I should probably be more verbose in the future), it was more of a feature request for a nice error message. Thanks for your help, Jonathan.
Subject: Bug 35786 Author: jakub Date: Thu Apr 3 21:01:26 2008 New Revision: 133874 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133874 Log: PR fortran/35786 * openmp.c (resolve_omp_clauses): Diagnose if a clause symbol isn't a variable. * gfortran.dg/gomp/pr35786-1.f90: New test. * gfortran.dg/gomp/pr35786-2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/pr35786-1.f90 trunk/gcc/testsuite/gfortran.dg/gomp/pr35786-2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/openmp.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 35786 Author: jakub Date: Thu Apr 3 21:20:53 2008 New Revision: 133877 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133877 Log: PR fortran/35786 * openmp.c (resolve_omp_clauses): Diagnose if a clause symbol isn't a variable. * gfortran.dg/gomp/pr35786-1.f90: New test. * gfortran.dg/gomp/pr35786-2.f90: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/gomp/pr35786-1.f90 branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/gomp/pr35786-2.f90 Modified: branches/gcc-4_3-branch/gcc/fortran/ChangeLog branches/gcc-4_3-branch/gcc/fortran/openmp.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed.