aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-11-25 17:33:21 +0000
committerRichard Stallman <rms@gnu.org>1992-11-25 17:33:21 +0000
commit32436219b6f789d1400d15e1da117d741033bf2e (patch)
tree59bfadcf80bb3f7ecbb9e9f4177389620ce7167d
parent8adfad0f10f5c5c96a174c3ffb196e9c6a0b31d3 (diff)
downloadgcc-32436219b6f789d1400d15e1da117d741033bf2e.zip
gcc-32436219b6f789d1400d15e1da117d741033bf2e.tar.gz
gcc-32436219b6f789d1400d15e1da117d741033bf2e.tar.bz2
(duplicate_decls): For builtins, create new function
type instead of trying to modify old one. (c_decode_option): Decode -Wreturn-type. From-SVN: r2794
-rw-r--r--gcc/c-decl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 5f5a191..7c7cab7 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1305,10 +1305,15 @@ duplicate_decls (newdecl, olddecl)
tree newreturntype = TREE_TYPE (TREE_TYPE (newdecl));
if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype))
{
- TREE_TYPE (TREE_TYPE (olddecl)) = newreturntype;
- types_match = comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
- if (!types_match)
- TREE_TYPE (TREE_TYPE (olddecl)) = oldreturntype;
+ /* Function types may be shared, so we can't just modify
+ the return type of olddecl's function type. */
+ tree newtype
+ = build_function_type (newreturntype,
+ TYPE_ARG_TYPES (TREE_TYPE (olddecl)));
+
+ types_match = comptypes (TREE_TYPE (newdecl), newtype);
+ if (types_match)
+ TREE_TYPE (olddecl) = newtype;
}
}
if (!types_match)