re PR middle-end/49945 (gcc.dg/guality/vla-1.c FAILs with -flto)
authorRichard Guenther <rguenther@suse.de>
Thu, 8 Dec 2011 11:43:12 +0000 (11:43 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 8 Dec 2011 11:43:12 +0000 (11:43 +0000)
2011-12-08  Richard Guenther  <rguenther@suse.de>

PR lto/49945
* lto-streamer-out.c (tree_is_indexable): Localize variably
modified types and their FIELD_DECLs.

From-SVN: r182107

gcc/ChangeLog
gcc/lto-streamer-out.c

index 1f26fa946c4d565e8f9392d8d5496475e2242d20..84083ed3ab23ff871406f608c9a4ce1175ab4435 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-08  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/49945
+       * lto-streamer-out.c (tree_is_indexable): Localize variably
+       modified types and their FIELD_DECLs.
+
 2011-12-08  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR tree-optimization/51315
index 655cf89bc288b768fb91d5a389b018e7e90af545..e5c79d11f624a8dd6b6ef2e09edcf024e2cd0a51 100644 (file)
@@ -139,6 +139,16 @@ tree_is_indexable (tree t)
           && DECL_CONTEXT (t)
           && TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL)
     return false;
+  /* Variably modified types need to be streamed alongside function
+     bodies because they can refer to local entities.  Together with
+     them we have to localize their members as well.
+     ???  In theory that includes non-FIELD_DECLs as well.  */
+  else if (TYPE_P (t)
+          && variably_modified_type_p (t, NULL_TREE))
+    return false;
+  else if (TREE_CODE (t) == FIELD_DECL
+          && variably_modified_type_p (DECL_CONTEXT (t), NULL_TREE))
+    return false;
   else
     return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME);
 }