diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-05-02 16:03:02 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-05-02 16:03:02 +0200 |
commit | 7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad (patch) | |
tree | 8027a27b3fb600becf052caf7dc0a3248112257e /gcc/testsuite/gcc.dg/ipa/pr56988.c | |
parent | 2c41c19d5dfc3de0c0b149dc0846c08422c5dded (diff) | |
download | gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.zip gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.tar.gz gcc-7b920a9ac3fa4a0c8b281ba13f1e689e2c7da4ad.tar.bz2 |
re PR middle-end/56988 (ipa-cp incorrectly propagates a field of an aggregate)
2013-05-02 Martin Jambor <mjambor@suse.cz>
PR middle-end/56988
* ipa-prop.h (ipa_agg_replacement_value): New flag by_ref.
* ipa-cp.c (ipa_get_indirect_edge_target_1): Also check that by_ref
flags match.
(find_aggregate_values_for_callers_subset): Fill in the by_ref flag of
ipa_agg_replacement_value structures.
(known_aggs_to_agg_replacement_list): Likewise.
* ipa-prop.c (write_agg_replacement_chain): Stream by_ref flag.
(read_agg_replacement_chain): Likewise.
(ipcp_transform_function): Also check that by_ref flags match.
testsuite/
* gcc.dg/ipa/pr56988.c: New test.
From-SVN: r198540
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/pr56988.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/pr56988.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/pr56988.c b/gcc/testsuite/gcc.dg/ipa/pr56988.c new file mode 100644 index 0000000..ab20159 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr56988.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-add-options bind_pic_locally } */ + +struct S +{ + int a, b, c; +}; + +volatile int g; + +static void __attribute__ ((noinline, noclone)) +bar (struct S **p) +{ + g = 5; +}; + +static void __attribute__ ((noinline)) +foo (struct S *p) +{ + int i = p->a; + if (i != 1) + __builtin_abort (); + bar (&p); +} + +int +main (int argc, char *argv[]) +{ + struct S s; + s.a = 1; + s.b = 64; + s.c = 32; + foo (&s); + + return 0; +} + |