re PR target/20795 (ICE in assign_parms)
authorJakub Jelinek <jakub@redhat.com>
Sat, 9 Apr 2005 17:09:49 +0000 (19:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 9 Apr 2005 17:09:49 +0000 (19:09 +0200)
PR target/20795
* config/i386/i386.c (construct_container): Pass empty aligned
struct, union or class in memory.

* g++.dg/abi/param2.C: New test.

From-SVN: r97912

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/param2.C [new file with mode: 0644]

index 1211bc9..937b958 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/20795
+       * config/i386/i386.c (construct_container): Pass empty aligned
+       struct, union or class in memory.
+
 2005-04-09  Kazu Hirata  <kazu@cs.umass.edu>
 
        * dominance.c, gthr-win32.h, reg-stack.c, tree-ssa-copy.c,
index e762fa7..427bfee 100644 (file)
@@ -2682,6 +2682,11 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
            abort ();
        }
     }
+
+  /* Empty aligned struct, union or class.  */
+  if (nexps == 0)
+    return NULL;
+
   ret =  gen_rtx_PARALLEL (mode, rtvec_alloc (nexps));
   for (i = 0; i < nexps; i++)
     XVECEXP (ret, 0, i) = exp [i];
index 14258a1..3654a7b 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/20795
+       * g++.dg/abi/param2.C: New test.
+
 2005-04-09  Uros Bizjak  <uros@kss-loka.si>
 
        * gcc.dg/builtins-53.c: New test.
diff --git a/gcc/testsuite/g++.dg/abi/param2.C b/gcc/testsuite/g++.dg/abi/param2.C
new file mode 100644 (file)
index 0000000..ed3c0df
--- /dev/null
@@ -0,0 +1,18 @@
+// PR target/20795
+// Test passing aligned empty aggregate
+// { dg-do compile }
+
+struct S { union {} a; } __attribute__((aligned));
+
+S
+foo (S arg)
+{
+  return arg;
+}
+
+void
+bar (void)
+{
+  S arg;
+  foo (arg);
+}