[committed] openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]

Jakub Jelinek jakub@redhat.com
Tue Dec 1 20:47:31 GMT 2020


Hi!

Since r11-5430 we ICE on the following testcase.  When parsing the depobj
directive we don't really use cp_parser_omp_all_clauses routine which ATM
disables generation of location wrappers and the newly added assertion
that there are no location wrappers thus triggers.

Fixed by adding the location wrappers suppression sentinel.

Longer term, we should handle location wrappers inside of OpenMP clauses.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk,
queued for backporting.

2020-12-01  Jakub Jelinek  <jakub@redhat.com>

	PR c++/98072
	* parser.c (cp_parser_omp_depobj): Suppress location wrappers when
	parsing depend clause.

	* c-c++-common/gomp/depobj-2.c: New test.

--- gcc/cp/parser.c.jj	2020-11-26 16:22:24.258406951 +0100
+++ gcc/cp/parser.c	2020-12-01 10:37:02.611703012 +0100
@@ -38784,6 +38784,8 @@ cp_parser_omp_depobj (cp_parser *parser,
       cp_lexer_consume_token (parser->lexer);
       if (!strcmp ("depend", p))
 	{
+	  /* Don't create location wrapper nodes within the depend clause.  */
+	  auto_suppress_location_wrappers sentinel;
 	  clause = cp_parser_omp_clause_depend (parser, NULL_TREE, c_loc);
 	  if (clause)
 	    clause = finish_omp_clauses (clause, C_ORT_OMP);
--- gcc/testsuite/c-c++-common/gomp/depobj-2.c.jj	2020-12-01 10:37:50.873159687 +0100
+++ gcc/testsuite/c-c++-common/gomp/depobj-2.c	2020-12-01 10:38:14.018899116 +0100
@@ -0,0 +1,11 @@
+/* PR c++/98072 */
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+  char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+void
+foo (int *x, omp_depend_t *y, int z)
+{
+  #pragma omp depobj (*y) depend (in: x[z])
+}


	Jakub



More information about the Gcc-patches mailing list