diff mbox

, PR 79212: Fix ICE when compiling fortran test with openmp

Message ID 20170125134621.GO1867@tucnak
State New
Headers show

Commit Message

Jakub Jelinek Jan. 25, 2017, 1:46 p.m. UTC
On Tue, Jan 24, 2017 at 05:27:26PM +0000, David Sherwood wrote:
> I have a patch to fix the following openmp issue:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79212
> 
> Writing openmp directives in a certain way in fortran programs can lead to
> the following assert:
> 
> internal compiler error: in maybe_lookup_decl_in_outer_ctx, at omp-low.c:4134
> 0xa941e6 maybe_lookup_decl_in_outer_ctx
>         /work/davshe01/oban-work-shoji/src/gcc/gcc/omp-low.c:4134
> 0xa9cadc scan_sharing_clauses
>         /work/davshe01/oban-work-shoji/src/gcc/gcc/omp-low.c:1975
> 
> Tested:
> aarch64 - No regressions in gcc/testsuite/fortran.dg, gcc/testsuite/gcc.dg,
> gcc/testsuite/g++.dg or libgomp/testsuite
> 
> Will do a full test run before submitting.
> 
> Good to go?
> David Sherwood.
> 
> ChangeLog:
> 
> 2017-01-24  David Sherwood  <david.sherwood@arm.com>
> 
>     PR middle-end/79212

This line should be intended by a single tab.

>     gcc/
>         * gimplify.c (omp_notice_variable): Add GOVD_SEEN flag to variables in all contexts.

These too.

>     gcc/testsuite/
>         * gfortran.dg/gomp/sharing-4.f90: New test.
> 

As this is conditional, if the decl won't be in ctx->variables splay tree,
bad things will happen (omp_notice_variable could complain loudly, or make
it shared etc. or whatever the default is).  So perhaps it should be
instead:
	  splay_tree_node n2;
	  tree t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
	  gcc_assert (DECL_P (t));
	  n2 = splay_tree_lookup (ctx->variables, (splay_tree_key) t);
	  if (n2)
	    omp_notice_variable (ctx, t, true);

Ok for trunk with those changes.

	Jakub
diff mbox

Patch

--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7147,12 +7147,9 @@  omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
 	       && (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl))))
 		   != INTEGER_CST))
 	{
-	  splay_tree_node n2;
 	  tree t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
 	  gcc_assert (DECL_P (t));
-	  n2 = splay_tree_lookup (ctx->variables, (splay_tree_key) t);
-	  if (n2)
-	    n2->value |= GOVD_SEEN;
+	  omp_notice_variable (ctx, t, true);
 	}
     }