This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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.

2017-08-01  Cesar Philippidis  <>
	    Thomas Schwinge  <>

	* 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 (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;
 	      args.safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
-						integer_type_node,
-						OMP_CLAUSE_WAIT_EXPR (c)));
+						integer_type_node, wait_expr));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]