Commit 753b34d7 by Aldy Hernandez Committed by Aldy Hernandez

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
parent ef9e1eff
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> 2008-08-06 Jan Hubicka <jh@suse.cz>
* predict.c (maybe_hot_frequency_p): When profile is absent, all * predict.c (maybe_hot_frequency_p): When profile is absent, all
......
...@@ -4217,7 +4217,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, ...@@ -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 side as statements and throw away the assignment. Do this after
gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable
types properly. */ 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 (from_p, pre_p);
gimplify_stmt (to_p, pre_p); gimplify_stmt (to_p, pre_p);
......
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> 2008-08-06 Arnaud Charlet <charlet@adacore.com>
* gnat.dg/iface_test.ad[s,b]: New test. * gnat.dg/iface_test.ad[s,b]: New test.
......
/* PR middle-end/35432 */
struct A
{
char c[0];
};
void foo(struct A a)
{
(a = a).c;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment