https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77374

            Bug ID: 77374
           Summary: ICE in resolve_omp_atomic, at fortran/openmp.c:3949
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

Invalid code with a displaced OpenMP directive.
Configured with --enable-checking=yes.


$ cat z1.f90
subroutine s1 (a, b)
   integer :: a, b
!$omp atomic
   b = b + a
!$omp atomic
end subroutine

subroutine s2 (x, z)
   integer :: x(2), z(2)
   z(1) = z(1) + x(1)
end subroutine


$ cat z2.f90
program p
   !integer :: x(1)
   !$omp atomic
   x(1) = x(1) + 1
end


$ gfortran-7-20160821 -fopenmp -c z1.f90
z1.f90:6:3:

 end subroutine
   1
Error: Unexpected END statement at (1)
z1.f90:8:0:

 subroutine s2 (x, z)

Error: Unclassifiable statement at (1)
z1.f90:9:24:

    integer :: x(2), z(2)
                        1
Error: Unexpected data declaration statement at (1)
z1.f90:10:3:

    z(1) = z(1) + x(1)
   1
Error: The function result on the lhs of the assignment at (1) must have the
pointer attribute.
f951: internal compiler error: in resolve_omp_atomic, at fortran/openmp.c:3949
0x6c69d8 resolve_omp_atomic
        ../../gcc/fortran/openmp.c:3949
0x6ec7dd gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10844
0x6eed92 resolve_codes
        ../../gcc/fortran/resolve.c:15560
0x6eee8e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:15595
0x6da1aa resolve_all_program_units
        ../../gcc/fortran/parse.c:5855
0x6da1aa gfc_parse_file()
        ../../gcc/fortran/parse.c:6107
0x71c622 gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:198

Reply via email to