diff mbox

[og7] Fix libgomp.oacc-c/asyncwait-2.c

Message ID 4143a2b6-ca91-123d-af59-318bf75d6d2d@codesourcery.com
State New
Headers show

Commit Message

Cesar Philippidis Aug. 1, 2017, 3:50 p.m. UTC
I pushed this patch to openacc-gcc-7-branch that fixes an ICE in
libgomp.oacc-c/asyncwait-2.c caused by the recent async backport from
gomp-4_0-branch. Before, expand_omp_target was expecting the wait clause
argument to be a constant value. This patch teaches that function to be
more flexible and allow variables.

Cesar
diff mbox

Patch

2017-08-01  Cesar Philippidis  <cesar@codesourcery.com>
	    Thomas Schwinge  <thomas@codesourcery.com>

	gcc/
	* omp-expand.c (expand_omp_target): Don't expect OMP_CLAUSE_WAIT_EXPR
	to be a constant expression.


diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 8301dcb0de5..bf1f127d8d6 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -7574,15 +7574,17 @@  expand_omp_target (struct omp_region *region)
 	for (; c; c = OMP_CLAUSE_CHAIN (c))
 	  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_WAIT)
 	    {
-	      if (tree_int_cst_compare (OMP_CLAUSE_WAIT_EXPR (c), noval) == 0)
+	      tree wait_expr = OMP_CLAUSE_WAIT_EXPR (c);
+
+	      if (TREE_CODE (wait_expr) == INTEGER_CST
+		  && tree_int_cst_compare (wait_expr, noval) == 0)
 		{
 		  noval_seen = true;
 		  continue;
 		}
 
 	      args.safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
-						integer_type_node,
-						OMP_CLAUSE_WAIT_EXPR (c)));
+						integer_type_node, wait_expr));
 	      num_waits++;
 	    }