With a missing save attribute : $ cat z1.f90 subroutine s real :: x x = 0.0 !$omp target update to(x) !$omp target x = x + 1.0 !$omp end target end $ gfortran-6 -g -O0 -Wall -fcheck=all -fopenmp -c z1.f90 z1.f90:4:0: !$omp target update to(x) internal compiler error: in lower_omp_target, at omp-low.c:16135
Compiles with save status : $ cat z2.f90 subroutine s real, save :: x !!$omp declare target(x) x = 0.0 !$omp target update to(x) !$omp target x = x + 1.0 !$omp end target end
Confirmed, ICE started with GCC 4.9.1, former releases report: /home/marxin/Programming/testcases/pr71705.f90:4.9: !$omp target update to(x) 1 Error: Unclassifiable OpenMP directive at (1) /home/marxin/Programming/testcases/pr71705.f90:5.9: !$omp target 1 Error: Unclassifiable OpenMP directive at (1) /home/marxin/Programming/testcases/pr71705.f90:7.9: !$omp end target 1 Error: Unclassifiable OpenMP directive at (1)
Created attachment 38801 [details] gcc7-pr71705.patch This used to be invalid in OpenMP 4.0 (for Fortran even GCC 6 supports only OpenMP 4.0), but is valid (though completely useless) in OpenMP 4.5 (the target update directive actions are ignored). That said, we shouldn't ICE on it.
Author: jakub Date: Thu Jun 30 17:39:52 2016 New Revision: 237887 URL: https://gcc.gnu.org/viewcvs?rev=237887&root=gcc&view=rev Log: PR fortran/71705 * trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on decls in to/from clauses. * gfortran.dg/gomp/pr71705.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-openmp.c trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Sat Jul 2 10:22:48 2016 New Revision: 237941 URL: https://gcc.gnu.org/viewcvs?rev=237941&root=gcc&view=rev Log: Backported from mainline 2016-06-30 Jakub Jelinek <jakub@redhat.com> PR fortran/71705 * trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on decls in to/from clauses. * gfortran.dg/gomp/pr71705.f90: New test. Added: branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 Modified: branches/gcc-6-branch/gcc/fortran/ChangeLog branches/gcc-6-branch/gcc/fortran/trans-openmp.c branches/gcc-6-branch/gcc/testsuite/ChangeLog
Author: jakub Date: Thu Jul 7 12:49:04 2016 New Revision: 238102 URL: https://gcc.gnu.org/viewcvs?rev=238102&root=gcc&view=rev Log: Backported from mainline 2016-06-30 Jakub Jelinek <jakub@redhat.com> PR fortran/71705 * trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on decls in to/from clauses. * gfortran.dg/gomp/pr71705.f90: New test. Added: branches/gcc-5-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 Modified: branches/gcc-5-branch/gcc/fortran/ChangeLog branches/gcc-5-branch/gcc/fortran/trans-openmp.c branches/gcc-5-branch/gcc/testsuite/ChangeLog
Fixed also for 5.5+.
Author: jakub Date: Thu Jul 7 21:53:53 2016 New Revision: 238146 URL: https://gcc.gnu.org/viewcvs?rev=238146&root=gcc&view=rev Log: Backported from mainline 2016-06-30 Jakub Jelinek <jakub@redhat.com> PR fortran/71705 * trans-openmp.c (gfc_trans_omp_clauses): Set TREE_ADDRESSABLE on decls in to/from clauses. * gfortran.dg/gomp/pr71705.f90: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/gomp/pr71705.f90 Modified: branches/gcc-4_9-branch/gcc/fortran/ChangeLog branches/gcc-4_9-branch/gcc/fortran/trans-openmp.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Fixed.