Hi! The following patch fixes ICE on target update construct clauses. While the testcase is (at runtime) invalid in OpenMP 4.0, it is valid in 4.5, and we shouldn't ICE on it anyway.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk, queued for 6.2 backport. 2016-06-30 Jakub Jelinek <ja...@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. --- gcc/fortran/trans-openmp.c.jj 2016-06-03 21:25:17.000000000 +0200 +++ gcc/fortran/trans-openmp.c 2016-06-30 12:39:15.253931614 +0200 @@ -2182,6 +2182,8 @@ gfc_trans_omp_clauses (stmtblock_t *bloc tree decl = gfc_get_symbol_decl (n->sym); if (gfc_omp_privatize_by_reference (decl)) decl = build_fold_indirect_ref (decl); + else if (DECL_P (decl)) + TREE_ADDRESSABLE (decl) = 1; if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) { tree type = TREE_TYPE (decl); --- gcc/testsuite/gfortran.dg/gomp/pr71705.f90.jj 2016-06-30 12:50:49.076186209 +0200 +++ gcc/testsuite/gfortran.dg/gomp/pr71705.f90 2016-06-30 12:48:06.000000000 +0200 @@ -0,0 +1,7 @@ +! PR fortran/71705 +! { dg-do compile } + + real :: x + x = 0.0 + !$omp target update to(x) +end Jakub