diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-02-14 11:22:53 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-02-14 11:22:53 +0100 |
commit | d76e68001b65e588d263a3984dc12b5263b60879 (patch) | |
tree | b659e85985df5f8c2a674b887b2ddcfba64b5a8d /gcc/c-decl.c | |
parent | 2a5e0aeacdd62807638a7223ae22b0e25ba13c3b (diff) | |
download | gcc-d76e68001b65e588d263a3984dc12b5263b60879.zip gcc-d76e68001b65e588d263a3984dc12b5263b60879.tar.gz gcc-d76e68001b65e588d263a3984dc12b5263b60879.tar.bz2 |
re PR c/5503 (GCC ignores prototype)
PR c/5503:
* c-decl.c (duplicate_decls): If builtin type has TYPE_ARG_TYPES NULL,
use arguments from newtype.
* gcc.dg/noncompile/20020213-1.c: New test.
From-SVN: r49763
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 746fa47..ea7942c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1548,6 +1548,22 @@ duplicate_decls (newdecl, olddecl, different_binding_level) if (! different_binding_level) TREE_TYPE (olddecl) = oldtype; } + else if (TYPE_ARG_TYPES (oldtype) == NULL + && TYPE_ARG_TYPES (newtype) != NULL) + { + /* For bcmp, bzero, fputs the builtin type has arguments not + specified. Use the ones from the prototype so that type checking + is done for them. */ + tree trytype + = build_function_type (TREE_TYPE (oldtype), + TYPE_ARG_TYPES (newtype)); + trytype = build_type_attribute_variant (trytype, + TYPE_ATTRIBUTES (oldtype)); + + oldtype = trytype; + if (! different_binding_level) + TREE_TYPE (olddecl) = oldtype; + } if (!types_match) { /* If types don't match for a built-in, throw away the built-in. */ |