On Fri, Mar 9, 2012 at 6:58 PM, Uros Bizjak <ubiz...@gmail.com> wrote:
> I would like to point out that the patched compiler now also emits > address registers in their natural mode (modulo zero-extended RTXes) > and fixes following failure on Pmode == SImode targets: > > --cut here-- > struct foo > { > int *f; > int i; > }; > > void > __attribute__ ((noinline)) > bar (struct foo x) > { > *(x.f) = 1; > } > --cut here-- > > For Pmode == SImode, the compiler emitted (%rdi) address, which was > wrong, since "i" was passed in the high part of (%rdi) register. Following patch adds torture test that check for this problem. 2012-03-11 Uros Bizjak <ubiz...@gmail.com> PR target/52530 * gcc.dg/torture/pr52530.c: New test. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline. Uros.
Index: gcc.dg/torture/pr52530.c =================================================================== --- gcc.dg/torture/pr52530.c (revision 0) +++ gcc.dg/torture/pr52530.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +extern void abort (void); + +struct foo +{ + int *f; + int i; +}; + +int baz; + +void __attribute__ ((noinline)) +bar (struct foo x) +{ + *(x.f) = x.i; +} + +int +main () +{ + struct foo x = { &baz, 0xdeadbeef }; + + bar (x); + + if (baz != 0xdeadbeef) + abort (); + + return 0; +}