This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86_64 argument passing fix


On Sun, 11 Aug 2002, Jan Hubicka wrote:

> the offset of nested structure fields is computed wrong.  I am
> installing the patch to mainline and queueing for 3.2.1. It affects only
> the x86_64 specific code but has been bootstrapped on i386.

As a reminder, both cases of PR target/7559 are hereunder:

2002-08-10  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>

	PR target/7559
	* testsuite/gcc.c-torture/execute/20020810-1.c: New test.

--- gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20020810-1.c.x86_64-struct-args	2002-08-13 10:59:50.000000000 +0200
+++ gcc-3.2/gcc/testsuite/gcc.c-torture/execute/20020810-1.c	2002-08-13 11:03:23.000000000 +0200
@@ -0,0 +1,38 @@
+/* PR target/7559
+   This testcase was miscompiled on x86-64, because classify_argument
+   wrongly computed the offset of nested structure fields.  */
+
+extern void abort (void);
+
+struct A
+{
+  long x;
+};
+
+struct R
+{
+  struct A a, b;
+};
+
+struct R R = { 100, 200 };
+
+void f (struct R r)
+{
+  if (r.a.x != R.a.x || r.b.x != R.b.x)
+    abort ();
+}
+
+struct R g (void)
+{
+  return R;
+}
+
+int main (void)
+{
+  struct R r;
+  f(R);
+  r = g();
+  if (r.a.x != R.a.x || r.b.x != R.b.x)
+    abort ();
+  return 0;
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]