diff mbox

[02/10] addr32: Only handle zero-extended DImode addresses

Message ID CAFULd4b8kNsfL9Eq3Wy5HmztdCJNHAprsDA7g7si5_oqR=ytog@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak March 11, 2012, 7:47 p.m. UTC
On Fri, Mar 9, 2012 at 6:58 PM, Uros Bizjak <ubizjak@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  <ubizjak@gmail.com>

	PR target/52530
	* gcc.dg/torture/pr52530.c: New test.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline.

Uros.
diff mbox

Patch

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;
+}