diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2008-08-06 10:25:22 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2008-08-06 10:25:22 +0000 |
commit | 753b34d777ee581aeb7efba828f8a509abe7e899 (patch) | |
tree | cc04e81d2999277fd0cae5ae1df5edc92d66f468 /gcc | |
parent | ef9e1eff51d6da72800ee7ca2179d0f8816dfa30 (diff) | |
download | gcc-753b34d777ee581aeb7efba828f8a509abe7e899.zip gcc-753b34d777ee581aeb7efba828f8a509abe7e899.tar.gz gcc-753b34d777ee581aeb7efba828f8a509abe7e899.tar.bz2 |
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: r138793
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr35432.c | 11 |
4 files changed, 22 insertions, 1 deletions
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 <aldyh@redhat.com> + + PR middle-end/35432 + * gimplify.c (gimplify_modify_expr): Do not optimize zero-sized types + if want_value. + 2008-08-06 Jan Hubicka <jh@suse.cz> * 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 <aldyh@redhat.com> + PR middle-end/35432 + * gcc.c-torture/compile/pr35432.c: New file. + 2008-08-06 Arnaud Charlet <charlet@adacore.com> * 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; +} |