re PR c/10602 (ICE in c-typeck.c (tree check failure))
authorSteven Bosscher <steven@gcc.gnu.org>
Thu, 24 Jul 2003 08:58:42 +0000 (08:58 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Thu, 24 Jul 2003 08:58:42 +0000 (08:58 +0000)
PR c/10602
* c-typeck.c (type_lists_compatible_p): Do not compare
arguments if one of them is an error_mark_node.

* gcc.dg/noncompile/incomplete-2.c: New test.

From-SVN: r69735

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/incomplete-2.c [new file with mode: 0644]

index d19ae2d964b868bf51d5dcfc42d1ca2b29f7545c..335ee18055c17e2515c2413da61cd0a41628d1a5 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-24  Steven Bosscher  <steven@gcc.gnu.org>
+
+       PR c/10602
+       * c-typeck.c (type_lists_compatible_p): Do not compare
+       arguments if one of them is an error_mark_node
+
 2003-07-24  Alan Modra  <amodra@bigpond.net.au>
 
        * config/rs6000/rs6000.c (rs6000_emit_prologue): Save fp regs inline
index 1fea1c534597df652584fc0121413ac3deb8e9ed..922cda89cf092a16ae60c198e69352103ed90967 100644 (file)
@@ -860,6 +860,10 @@ type_lists_compatible_p (tree args1, tree args2, int flags)
          if (c_type_promotes_to (TREE_VALUE (args1)) != TREE_VALUE (args1))
            return 0;
        }
+      /* If one of the lists has an error marker, ignore this arg.  */
+      else if (TREE_CODE (TREE_VALUE (args1)) == ERROR_MARK
+              || TREE_CODE (TREE_VALUE (args2)) == ERROR_MARK)
+       ;
       else if (! (newval = comptypes (TYPE_MAIN_VARIANT (TREE_VALUE (args1)),
                                      TYPE_MAIN_VARIANT (TREE_VALUE (args2)),
                                      flags)))
index 1e703c101646b20c76e72f39b3697311acd2f7b0..4881e5ae45b26627d0840bd6282519430e54e4ed 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-23  Steven Bosscher <steven@gcc.gnu.org>
+
+       PR c/10602
+       * gcc.dg/noncompile/incomplete-2.c: New test.
+
 2003-07-23  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/11645
diff --git a/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c b/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c
new file mode 100644 (file)
index 0000000..19864b9
--- /dev/null
@@ -0,0 +1,12 @@
+/* Origin: <steven@gcc.gnu.org>
+   Make sure we do not ICE when the type in the function
+   argument list is incomplete (Bug 10602).  */
+/* { dg-options "-w" } */
+
+int g95_type_for_mode (enum machine_mode);
+
+int
+g95_type_for_mode (enum machine_mode mode)
+{ /* { dg-error "has incomplete type" } */
+  return 0;
+}