From 3e23fb2e8b8e1dee5dd24f750548000846830d38 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Thu, 4 Mar 2010 11:59:19 -0800 Subject: [PATCH] re PR c/43248 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at tree-ssa.c:1233) 2010-03-04 Andrew Pinski PR c/43248 * c-decl.c (build_compound_literal): Return early if init is an error_mark_node. 2010-03-04 Andrew Pinski PR c/43248 * gcc.dg/compound-literal-1.c: New testcase. From-SVN: r157233 --- gcc/ChangeLog | 6 ++++++ gcc/c-decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/compound-literal-1.c | 9 +++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/compound-literal-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 13974184acd..dc260e58149 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-04 Andrew Pinski + + PR c/43248 + * c-decl.c (build_compound_literal): Return early if init is + an error_mark_node. + 2010-03-04 Martin Jambor PR tree-optimization/43164 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f0b6463dc15..87fb19a3d47 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca2b87539ef..57e2fa6da33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-04 Andrew Pinski + + PR c/43248 + * gcc.dg/compound-literal-1.c: New testcase. + 2010-03-04 Martin Jambor 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 index 00000000000..6c644d46ea3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compound-literal-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +/* PR c/43248 */ + +int foo(__SIZE_TYPE__ i) +{ + i ? : (void *){}; /* { dg-error "" } */ +} +