gcc/gcc44-pr39903.patch

80 lines
1.8 KiB
Diff

2009-04-26 H.J. Lu <hongjiu.lu@intel.com>
PR target/39903
* config/i386/i386.c (construct_container): Don't call
gen_reg_or_parallel with BLKmode for X86_64_SSE_CLASS,
X86_64_SSESF_CLASS and X86_64_SSEDF_CLASS.
PR target/39903
* gcc.dg/torture/pr39903-1.c: New.
* gcc.dg/torture/pr39903-2.c: Likewise.
--- gcc/config/i386/i386.c (revision 146817)
+++ gcc/config/i386/i386.c (working copy)
@@ -5466,7 +5466,10 @@ construct_container (enum machine_mode m
case X86_64_SSE_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSEDF_CLASS:
- return gen_reg_or_parallel (mode, orig_mode, SSE_REGNO (sse_regno));
+ if (mode != BLKmode)
+ return gen_reg_or_parallel (mode, orig_mode,
+ SSE_REGNO (sse_regno));
+ break;
case X86_64_X87_CLASS:
case X86_64_COMPLEX_X87_CLASS:
return gen_rtx_REG (mode, FIRST_STACK_REG);
--- gcc/testsuite/gcc.dg/torture/pr39903-1.c (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr39903-1.c (revision 0)
@@ -0,0 +1,24 @@
+/* PR target/39903 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+
+struct X {
+ double d;
+ double b[];
+};
+
+struct X __attribute__((noinline))
+foo (double d)
+{
+ struct X x;
+ x.d = d;
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ struct X x = foo(3.0);
+ if (x.d != 3.0)
+ abort ();
+ return 0;
+}
--- gcc/testsuite/gcc.dg/torture/pr39903-2.c (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr39903-2.c (revision 0)
@@ -0,0 +1,24 @@
+/* PR target/39903 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+
+struct X {
+ float d;
+ float b[];
+};
+
+struct X __attribute__((noinline))
+foo (float d)
+{
+ struct X x;
+ x.d = d;
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ struct X x = foo(3.0);
+ if (x.d != 3.0)
+ abort ();
+ return 0;
+}