From: aldyh Date: Wed, 6 Aug 2008 10:25:22 +0000 (+0000) Subject: PR middle-end/35432 X-Git-Tag: upstream/4.9.2~40527 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6090c119ec004ea2c30ebe04d13e8dd0c096199;p=platform%2Fupstream%2Flinaro-gcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138793 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3facfdb..b38ccbb 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-08-06 Jan Hubicka * predict.c (maybe_hot_frequency_p): When profile is absent, all diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e7fc167..555a5b6 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4217,7 +4217,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, 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, pre_p); gimplify_stmt (to_p, pre_p); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a1b82c..1e035f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-08-06 Aldy Hernandez + PR middle-end/35432 + * gcc.c-torture/compile/pr35432.c: New file. + 2008-08-06 Arnaud Charlet * gnat.dg/iface_test.ad[s,b]: 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 0000000..6a0c921 --- /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; +}