aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2004-05-21 00:11:06 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2004-05-20 17:11:06 -0700
commitf69a11209a5eb346e0e79ea95060d7c22999c210 (patch)
tree912bb4099cc4544a0d8e251d3674f7ab10b11ff5
parent0ef54a47cf6012a588dc89ce63d2cf8d3106414f (diff)
downloadgcc-f69a11209a5eb346e0e79ea95060d7c22999c210.zip
gcc-f69a11209a5eb346e0e79ea95060d7c22999c210.tar.gz
gcc-f69a11209a5eb346e0e79ea95060d7c22999c210.tar.bz2
re PR target/15302 ([3.3/3.4 only] gcc not consistent for passing structures with complex in them)
2004-05-20 H.J. Lu <hongjiu.lu@intel.com> PR target/15302 * gcc.dg/compat/struct-complex-1.h: New file. * gcc.dg/compat/struct-complex-1_main.c: Likewise. * gcc.dg/compat/struct-complex-1_x.c: Likewise. * gcc.dg/compat/struct-complex-1_y.c: Likewise. From-SVN: r82076
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-complex-1.h17
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-complex-1_main.c21
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c29
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c21
5 files changed, 96 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9a9b2da..f2fa8f4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/15302
+ * gcc.dg/compat/struct-complex-1.h: New file.
+ * gcc.dg/compat/struct-complex-1_main.c: Likewise.
+ * gcc.dg/compat/struct-complex-1_x.c: Likewise.
+ * gcc.dg/compat/struct-complex-1_y.c: Likewise.
+
2004-05-20 Roger Sayle <roger@eyesopen.com>
PR middle-end/3074
diff --git a/gcc/testsuite/gcc.dg/compat/struct-complex-1.h b/gcc/testsuite/gcc.dg/compat/struct-complex-1.h
new file mode 100644
index 0000000..8b53937
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-complex-1.h
@@ -0,0 +1,17 @@
+#include <complex.h>
+
+struct st
+{
+ int s1;
+ float complex x;
+ int s2;
+};
+
+typedef struct { float r, i; } _complex;
+
+struct stc
+{
+ int s1;
+ _complex x;
+ int s2;
+};
diff --git a/gcc/testsuite/gcc.dg/compat/struct-complex-1_main.c b/gcc/testsuite/gcc.dg/compat/struct-complex-1_main.c
new file mode 100644
index 0000000..92e886a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-complex-1_main.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+/* Test function argument passing. PR target/15302. */
+
+extern void struct_complex_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_complex_1_x ();
+ exit (0);
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif
diff --git a/gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c b/gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c
new file mode 100644
index 0000000..180d58a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-complex-1_x.c
@@ -0,0 +1,29 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+#include "struct-complex-1.h"
+
+struct st st1;
+struct stc st2;
+
+extern void foo ();
+extern void bar ();
+
+int
+struct_complex_1_x ()
+{
+ st1.s1 = 1;
+ st1.s2 = 2;
+ __real__ st1.x = 2;
+ __imag__ st1.x = 4;
+ st2.s1 = 1;
+ st2.s2 = 2;
+ st2.x.r = 2;
+ st2.x.i = 4;
+ foo (st1);
+ foo (st2);
+ bar (st1);
+ bar (st2);
+ return 0;
+}
+#endif
diff --git a/gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c b/gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c
new file mode 100644
index 0000000..0f0c3f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-complex-1_y.c
@@ -0,0 +1,21 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+#include <stdlib.h>
+#include "struct-complex-1.h"
+
+void
+bar(struct st x)
+{
+ if (x.s1 != 1 || x.s2 != 2
+ || __real__ x.x != 2 || __imag__ x.x != 4)
+ abort ();
+}
+
+void
+foo(struct stc x)
+{
+ if (x.s1 != 1 || x.s2 != 2 || x.x.r != 2 || x.x.i != 4)
+ abort ();
+}
+#endif