aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2004-01-23 18:13:55 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-01-23 18:13:55 +0000
commit04b8f97f29948de584315b23a38d8d1cfc85bd17 (patch)
treecfd782672a48cf6a1c62786f30ac6d027af6b1d6 /gcc/c-decl.c
parent1ab1739cc6a8c6c9f11075339fea83241a7e966f (diff)
downloadgcc-04b8f97f29948de584315b23a38d8d1cfc85bd17.zip
gcc-04b8f97f29948de584315b23a38d8d1cfc85bd17.tar.gz
gcc-04b8f97f29948de584315b23a38d8d1cfc85bd17.tar.bz2
re PR c/18314 (Abnormal behavior in optimization)
PR 18314 * c-decl.c (diagnose_mismatched_decls): Also discard a built-in if we encounter an old-style definition with the same name. testsuite: * gcc.dg/builtins-30.c: New testcase. From-SVN: r76441
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 9316c62..3af82f4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1029,11 +1029,15 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
extern-inline definition supersedes the extern-inline definition. */
else if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- if (DECL_BUILT_IN (olddecl) && !TREE_PUBLIC (newdecl))
+ /* If you declare a built-in function name as static, or
+ define the built-in with an old-style definition (so we
+ can't validate the argument list) the built-in definition is
+ overridden, but optionally warn this was a bad choice of name. */
+ if (DECL_BUILT_IN (olddecl)
+ && (!TREE_PUBLIC (newdecl)
+ || (DECL_INITIAL (newdecl)
+ && !TYPE_ARG_TYPES (TREE_TYPE (newdecl)))))
{
- /* If you declare a built-in function name as static, the
- built-in definition is overridden,
- but optionally warn this was a bad choice of name. */
if (warn_shadow)
warning ("%Jshadowing built-in function '%D'", newdecl, newdecl);
/* Discard the old built-in function. */