re PR target/27421 (ICE with invalid array in struct)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Thu, 8 Jun 2006 20:50:24 +0000 (20:50 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 8 Jun 2006 20:50:24 +0000 (20:50 +0000)
PR target/27421
* config/i386/i386.c (classify_argument): Skip fields with invalid
types in unions.

* gcc.dg/union-3.c: New test.

From-SVN: r114494

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/union-3.c [new file with mode: 0644]

index 66a413083976ea9d560a511fc069908461fce231..ca5851cc2559df7ffe5dd460b110b94d3fc67625 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR target/27421
+       * config/i386/i386.c (classify_argument): Skip fields with invalid
+       types in unions.
+
 2006-06-08  Steven Bosscher  <steven@gcc.gnu.org>
 
        * cse.c (flush_hash_table): Use VOIDmode to invalidate a REG.
index 743535cfe71aa5da6e65cdda484d15685edc7aa2..7903cb2bfdd9967a1d528297f21879eaa3728d64 100644 (file)
@@ -3045,6 +3045,10 @@ classify_argument (enum machine_mode mode, tree type,
              if (TREE_CODE (field) == FIELD_DECL)
                {
                  int num;
+
+                 if (TREE_TYPE (field) == error_mark_node)
+                   continue;
+
                  num = classify_argument (TYPE_MODE (TREE_TYPE (field)),
                                           TREE_TYPE (field), subclasses,
                                           bit_offset);
index cfeeaeb83e2e5f3e9ee3569b00ef0ae09cd861a7..1d5b76aec01a2eff36d0f967e02a7df9c31f6d93 100644 (file)
@@ -1,3 +1,8 @@
+2006-06-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR target/27421
+       * gcc.dg/union-3.c: New test.
+
 2006-06-08  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/27116
diff --git a/gcc/testsuite/gcc.dg/union-3.c b/gcc/testsuite/gcc.dg/union-3.c
new file mode 100644 (file)
index 0000000..3e89b75
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/27421 */
+/* { dg-do compile } */
+
+union A
+{
+  int i;
+  void x[1];  /* { dg-error "array of voids" } */
+};
+
+void foo(union A a) {}