]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/69483 (gcc ICE on x86_64-linux-gnu with "expected class ...
authorJakub Jelinek <jakub@redhat.com>
Tue, 26 Jan 2016 15:51:51 +0000 (16:51 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 26 Jan 2016 15:51:51 +0000 (16:51 +0100)
PR tree-optimization/69483
* gimple-fold.c (canonicalize_constructor_val): Return NULL
if base has error_mark_node type.

* c-parser.c (c_parser_translation_unit): Use FOR_EACH_VEC_ELT.

* gcc.dg/pr69483.c: New test.
* g++.dg/opt/pr69483.C: New test.

From-SVN: r232833

gcc/ChangeLog
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr69483.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr69483.c [new file with mode: 0644]

index a8f68e7e0b210675e68056ff1039be3834eacd29..37a3782c20f7549976fc977b4c5ee1f574f9f8a8 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69483
+       * gimple-fold.c (canonicalize_constructor_val): Return NULL
+       if base has error_mark_node type.
+
 2016-01-26  Christophe Lyon  <christophe.lyon@linaro.org>
 
        PR target/68620
index 5577518999e72d05effdd549fd90f4924e7ed21b..7d6250e586a63c4ae731a3ab11b216123cbc37a7 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69483
+       * c-parser.c (c_parser_translation_unit): Use FOR_EACH_VEC_ELT.
+
 2016-01-20  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR c/24293
index efac47b62bbc1828c6b487225a8de53a9770ad37..eede3a745fa9d71f2fbcf91cfd1edd1287b6898e 100644 (file)
@@ -1431,15 +1431,14 @@ c_parser_translation_unit (c_parser *parser)
       while (c_parser_next_token_is_not (parser, CPP_EOF));
     }
 
-  for (unsigned i = 0; i < incomplete_record_decls.length (); ++i)
-    {
-      tree decl = incomplete_record_decls[i];
-      if (DECL_SIZE (decl) == NULL_TREE && TREE_TYPE (decl) != error_mark_node)
-       {
-         error ("storage size of %q+D isn%'t known", decl);
-         TREE_TYPE (decl) = error_mark_node;
-       }
-    }
+  unsigned int i;
+  tree decl;
+  FOR_EACH_VEC_ELT (incomplete_record_decls, i, decl)
+    if (DECL_SIZE (decl) == NULL_TREE && TREE_TYPE (decl) != error_mark_node)
+      {
+       error ("storage size of %q+D isn%'t known", decl);
+       TREE_TYPE (decl) = error_mark_node;
+      }
 }
 
 /* Parse an external declaration (C90 6.7, C99 6.9).
index 70871cfcf27a6fcf5557a81644c7569d7e1d668b..eb130d048469f0b8196e565fed9a40de74b098bd 100644 (file)
@@ -195,6 +195,8 @@ canonicalize_constructor_val (tree cval, tree from_decl)
           || TREE_CODE (base) == FUNCTION_DECL)
          && !can_refer_decl_in_current_unit_p (base, from_decl))
        return NULL_TREE;
+      if (TREE_TYPE (base) == error_mark_node)
+       return NULL_TREE;
       if (TREE_CODE (base) == VAR_DECL)
        TREE_ADDRESSABLE (base) = 1;
       else if (TREE_CODE (base) == FUNCTION_DECL)
index 033faa372b609b39c50021fee90440bef6a5d1dc..3d0cc309eefc8648471dfea8662afef8fb0ad72a 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/69483
+       * gcc.dg/pr69483.c: New test.
+       * g++.dg/opt/pr69483.C: New test.
+
 2016-01-26  Christophe Lyon  <christophe.lyon@linaro.org>
 
        PR target/68620
diff --git a/gcc/testsuite/g++.dg/opt/pr69483.C b/gcc/testsuite/g++.dg/opt/pr69483.C
new file mode 100644 (file)
index 0000000..866aba8
--- /dev/null
@@ -0,0 +1,6 @@
+// PR tree-optimization/69483
+// { dg-do compile }
+
+struct T { struct S *a; };
+struct S b; // { dg-error "aggregate 'S b' has incomplete type and cannot be defined" }
+struct T c = { &b };
diff --git a/gcc/testsuite/gcc.dg/pr69483.c b/gcc/testsuite/gcc.dg/pr69483.c
new file mode 100644 (file)
index 0000000..2ab9dc3
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR tree-optimization/69483 */
+/* { dg-do compile } */
+
+struct T { struct S *a; };
+struct S b; /* { dg-error "storage size of 'b' isn't known" } */
+struct T c = { &b };