diff mbox

[hsa] Fix segfault in fixup_child_record_type

Message ID 20151008171117.GS7998@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Oct. 8, 2015, 5:11 p.m. UTC
Hi,

I have committed the following patch to the hsa branch, toput the
bail-out test in fixup_child_record_type all the way to the top where
it should be, otherwise we get segfaults when gridifying kernels with
variable-sized variables.

Martin


2015-10-08  Martin Jambor  <mjambor@suse.cz>

	* omp-low.c (fixup_child_record_type): Bail out early if
	ctx->receiver_decl is NULL.
diff mbox

Patch

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 65cc5c3..a21d301 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1613,6 +1613,8 @@  fixup_child_record_type (omp_context *ctx)
 {
   tree f, type = ctx->record_type;
 
+  if (!ctx->receiver_decl)
+    return;
   /* ??? It isn't sufficient to just call remap_type here, because
      variably_modified_type_p doesn't work the way we expect for
      record types.  Testing each field for whether it needs remapping
@@ -1652,9 +1654,8 @@  fixup_child_record_type (omp_context *ctx)
       layout_type (type);
     }
 
-  if (ctx->receiver_decl)
-    TREE_TYPE (ctx->receiver_decl)
-      = build_qualified_type (build_reference_type (type), TYPE_QUAL_RESTRICT);
+  TREE_TYPE (ctx->receiver_decl)
+    = build_qualified_type (build_reference_type (type), TYPE_QUAL_RESTRICT);
 }
 
 /* Instantiate decls as necessary in CTX to satisfy the data sharing