re PR c/43248 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark...
authorAndrew Pinski <andrew.pinski@caviumnetworks.com>
Thu, 4 Mar 2010 19:59:19 +0000 (11:59 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 4 Mar 2010 19:59:19 +0000 (11:59 -0800)
2010-03-04  Andrew Pinski  <andrew_pinski@caviumnetworks.com>

        PR c/43248
        * c-decl.c (build_compound_literal): Return early if init is
        an error_mark_node.
2010-03-04  Andrew Pinski  <andrew_pinski@caviumnetworks.com>

        PR c/43248
        * gcc.dg/compound-literal-1.c: New testcase.

From-SVN: r157233

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/compound-literal-1.c [new file with mode: 0644]

index 1397418..dc260e5 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-04  Andrew Pinski  <andrew_pinski@caviumnetworks.com>
+
+       PR c/43248
+       * c-decl.c (build_compound_literal): Return early if init is
+       an error_mark_node.
+
 2010-03-04  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/43164
index f0b6463..87fb19a 100644 (file)
@@ -4462,7 +4462,8 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const)
   tree complit;
   tree stmt;
 
-  if (type == error_mark_node)
+  if (type == error_mark_node
+      || init == error_mark_node)
     return error_mark_node;
 
   decl = build_decl (loc, VAR_DECL, NULL_TREE, type);
index ca2b875..57e2fa6 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-04  Andrew Pinski  <andrew_pinski@caviumnetworks.com>
+
+       PR c/43248
+       * gcc.dg/compound-literal-1.c: New testcase.
+
 2010-03-04  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/43164
diff --git a/gcc/testsuite/gcc.dg/compound-literal-1.c b/gcc/testsuite/gcc.dg/compound-literal-1.c
new file mode 100644 (file)
index 0000000..6c644d4
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+/* PR c/43248 */
+
+int foo(__SIZE_TYPE__ i)
+{
+  i ? : (void *){}; /* { dg-error "" } */
+}
+