From: Richard Stallman Date: Wed, 25 Nov 1992 17:33:21 +0000 (+0000) Subject: (duplicate_decls): For builtins, create new function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32436219b6f789d1400d15e1da117d741033bf2e;p=gcc.git (duplicate_decls): For builtins, create new function type instead of trying to modify old one. (c_decode_option): Decode -Wreturn-type. From-SVN: r2794 --- diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 5f5a19181f6..7c7cab71d05 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)