public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix ICE with !$omp target update (PR fortran/71705)
@ 2016-06-30 17:41 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2016-06-30 17:41 UTC (permalink / raw)
  To: gcc-patches, fortran

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  <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.

--- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-30 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-30 17:41 [committed] Fix ICE with !$omp target update (PR fortran/71705) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).