re PR lto/64373 (ICE with lto related to variably modified type)
authorRichard Biener <rguenther@suse.de>
Tue, 13 Jan 2015 13:57:27 +0000 (13:57 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 13 Jan 2015 13:57:27 +0000 (13:57 +0000)
2015-01-13  Richard Biener  <rguenther@suse.de>

PR lto/64373
* lto-streamer-out.c (tree_is_indexable): Guard for NULL
DECL_CONTEXT.

* gcc.dg/lto/pr64373_0.c: New testcase.

From-SVN: r219531

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr64373_0.c [new file with mode: 0644]

index 2b1449b3f21ca4a3e9c9fd3d65ed04a292603c8e..6bf509eb131a68fa85f973f5af07578da00ecbf6 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-13  Richard Biener  <rguenther@suse.de>
+
+       PR lto/64373
+       * lto-streamer-out.c (tree_is_indexable): Guard for NULL
+       DECL_CONTEXT.
+
 2015-01-13  Andrew Pinski   <apinski@cavium.com>
 
        * config/aarch64/aarch64.c (aarch64_operands_ok_for_ldpstp): Reject
index 21a78bb77aa92a29e361ea84d3cf771f521e7c98..3b581918d6ad1dbcf305e8b27a0dcbac7750a476 100644 (file)
@@ -154,7 +154,8 @@ tree_is_indexable (tree t)
   /* Parameters and return values of functions of variably modified types
      must go to global stream, because they may be used in the type
      definition.  */
-  if (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
+  if ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
+      && DECL_CONTEXT (t))
     return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE);
   /* IMPORTED_DECL is put into BLOCK and thus it never can be shared.  */
   else if (TREE_CODE (t) == IMPORTED_DECL)
index 8a5a62e2f883364d5448ab9ce3655e97053c933b..a3fea9be37f72115ed1b051d23a260fb89983c69 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Richard Biener  <rguenther@suse.de>
+
+       PR lto/64373
+       * gcc.dg/lto/pr64373_0.c: New testcase.
+
 2015-01-13  Andrew Pinski  <apinski@cavium.com>
 
        * gcc.target/aarch64/volatileloadpair-1.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/lto/pr64373_0.c b/gcc/testsuite/gcc.dg/lto/pr64373_0.c
new file mode 100644 (file)
index 0000000..b4f3fdf
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-lto-do assemble } */
+
+extern void b(int L, float (*data)[L]);
+
+void a(void)
+{
+  float* p = 0;
+  int i = 0;
+  b(10, (float (*)[10])(p + i));
+}