re PR c/35750 (ICE with invalid old-style parameter declaration)
authorVolker Reichelt <v.reichelt@netcologne.de>
Mon, 31 Mar 2008 19:37:45 +0000 (19:37 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 31 Mar 2008 19:37:45 +0000 (19:37 +0000)
PR c/35750
* c-decl.c (store_parm_decls_oldstyle): Skip invalid parameters.

* gcc.dg/old-style-param-1.c: New test.

From-SVN: r133771

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/old-style-param-1.c [new file with mode: 0644]

index c3e9ffd27b499c3f737e8c9dcb40261ac5aba3aa..45eff3e98b3e6c39029f9011dda20679c4c3e721 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-31  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35750
+       * c-decl.c (store_parm_decls_oldstyle): Skip invalid parameters.
+
 2008-03-31  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/30186
index 04b36d50d885fbff805c2a3f23ae7eb9177e7190..d86bca07be8d50f75368616bb43b0fc31a998748 100644 (file)
@@ -6483,8 +6483,10 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
          /* Type for passing arg must be consistent with that
             declared for the arg.  ISO C says we take the unqualified
             type for parameters declared with qualified type.  */
-         if (!comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)),
-                         TYPE_MAIN_VARIANT (TREE_VALUE (type))))
+         if (TREE_TYPE (parm) != error_mark_node
+             && TREE_TYPE (type) != error_mark_node
+             && !comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)),
+                            TYPE_MAIN_VARIANT (TREE_VALUE (type))))
            {
              if (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
                  == TYPE_MAIN_VARIANT (TREE_VALUE (type)))
index ba35c2b25426661c528fd80ca1bc62dcf8d05ca2..eddd5c955644207ef9a453d33b17b73408fac484 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-31  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35750
+       * gcc.dg/old-style-param-1.c: New test.
+
 2008-03-31  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/object_overflow.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/old-style-param-1.c b/gcc/testsuite/gcc.dg/old-style-param-1.c
new file mode 100644 (file)
index 0000000..1742069
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR c/35750 */
+
+void foo(int[]);
+void foo(x) int x[](); {} /* { dg-error "array of functions" } */