From: Aldy Hernandez Date: Wed, 6 Aug 2008 10:41:39 +0000 (+0000) Subject: re PR middle-end/35432 (ICE with zero-sized array) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72fb30c8382ef2f90b36c09706200af46936100f;p=thirdparty%2Fgcc.git re PR middle-end/35432 (ICE with zero-sized array) PR middle-end/35432 * gimplify.c (gimplify_modify_expr): Do not optimize zero-sized types if want_value. testsuite/ * gcc.c-torture/compile/pr35432.c: New file. From-SVN: r138796 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ec48495f51f..b78472ea0ec7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-06 Aldy Hernandez + + PR middle-end/35432 + * gimplify.c (gimplify_modify_expr): Do not optimize + zero-sized types if want_value. + 2008-07-04 Alan Modra PR target/36634 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fa2035bc39c9..ea43aaf64bf5 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3540,7 +3540,7 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) side as statements and throw away the assignment. Do this after gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable types properly. */ - if (zero_sized_type (TREE_TYPE (*from_p))) + if (zero_sized_type (TREE_TYPE (*from_p)) && !want_value) { gimplify_stmt (from_p); gimplify_stmt (to_p); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b18bb71184a8..4491ffee3513 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-06 Aldy Hernandez + + PR middle-end/35432 + * gcc.c-torture/compile/pr35432.c: New file. + 2008-05-29 Eric Botcazou * gcc.dg/nested-func-6.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35432.c b/gcc/testsuite/gcc.c-torture/compile/pr35432.c new file mode 100644 index 000000000000..6a0c92177465 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35432.c @@ -0,0 +1,11 @@ +/* PR middle-end/35432 */ + +struct A +{ + char c[0]; +}; + +void foo(struct A a) +{ + (a = a).c; +}