From 32436219b6f789d1400d15e1da117d741033bf2e Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Wed, 25 Nov 1992 17:33:21 +0000 Subject: [PATCH] (duplicate_decls): For builtins, create new function type instead of trying to modify old one. (c_decode_option): Decode -Wreturn-type. From-SVN: r2794 --- gcc/c-decl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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) -- 2.30.2