aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2006-08-25 22:11:46 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2006-08-25 22:11:46 +0100
commitd8890adf2810806a04e98ba517ac87b27b770ffa (patch)
treec5d660b0cc2b1511757821e913c937802626245b /gcc/c-decl.c
parent02709c7f68600ee88d126671b06012f8e90769b5 (diff)
downloadgcc-d8890adf2810806a04e98ba517ac87b27b770ffa.zip
gcc-d8890adf2810806a04e98ba517ac87b27b770ffa.tar.gz
gcc-d8890adf2810806a04e98ba517ac87b27b770ffa.tar.bz2
re PR c/28299 (ICE with -Wmissing-prototypes)
PR c/28299 * c-decl.c (start_function): Don't try to process prototype information from old declaration that isn't a function. testsuite: * gcc.dg/funcdef-var-1.c, gcc.dg/funcdef-var-2.c: New tests. * gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c: Expect extra diagnostics. From-SVN: r116435
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 494c221..cf89191 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5991,6 +5991,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* If this definition isn't a prototype and we had a prototype declaration
before, copy the arg type info from that prototype. */
old_decl = lookup_name_in_scope (DECL_NAME (decl1), current_scope);
+ if (old_decl && TREE_CODE (old_decl) != FUNCTION_DECL)
+ old_decl = 0;
current_function_prototype_locus = UNKNOWN_LOCATION;
current_function_prototype_built_in = false;
current_function_prototype_arg_types = NULL_TREE;