From patchwork Tue Nov 29 10:16:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 84546 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp2186157obn; Tue, 29 Nov 2016 02:16:45 -0800 (PST) X-Received: by 10.98.144.86 with SMTP id a83mr26660567pfe.107.1480414605376; Tue, 29 Nov 2016 02:16:45 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v3si30634084plb.121.2016.11.29.02.16.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 02:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-442866-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-442866-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-442866-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=LjiSudvg+t8R80TLy/F63RiqtogIrNOiJ3sHHX3PgSEzIoywic 1FlkRuw2aRcbX2IGnslOxq4zzM8OC9BoMKhhVjONhmQ4se6thnlhJn8JZmZVykza QydCLP5Rg0dec2w4sX0qUQFAB1ibSNfSgEDMNoaRqsDLEqAsMZPr8hyy0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=3UXL2KD7F+vgEFYMyhJFMUDGw1s=; b=Va4CaGF3xEqlPcjwkYcx IF3rdrojsMWJk0MrOp7xu23iXQFrAyrz0b9zHsu8jy64jXyzxaiK1CjMJPS29QMU Jm4VoQASiMh3ZydHbGNOaHBqJ3a72eQSl5xRwrspQbSrQcj5dqo082cjE9+ct0yK ey7ai/DfQ9071cQFpBoVjnc= Received: (qmail 13127 invoked by alias); 29 Nov 2016 10:16:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 13117 invoked by uid 89); 29 Nov 2016 10:16:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*MI:2dc6, H*M:2dc6 X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Nov 2016 10:16:19 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 39.9 DYNA|AUTH) with ESMTPSA id j075c4sATAGFGfb (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 29 Nov 2016 11:16:15 +0100 (CET) To: gcc-patches Cc: Richard Biener From: Georg-Johann Lay Subject: [patch, lto] Fix PR78562: Wrong type mismatch warning for built-ins with same asm name. Message-ID: <1058a106-2dc6-095d-9f82-e5add2edce2e@gjlay.de> Date: Tue, 29 Nov 2016 11:16:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes This is a fix for a wrong warning from -Wlto-type-mismatch that reports a type mismatch for two built-in functions. The avr backend has several built-ins that have the same asm name because their assembler implementation in libgcc is exactly the same. The prototypes might differ, however. This patch skips the warning for built-in types as discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78562#c6 Testing against avr-unknown-none, this resolves all FAILs because of that warning, e.g. gcc.target/avr/torture/builtins-5-countlsfx.c Ok for trunk? Johann gcc/lto/ PR lto/78562 * lto-symtab.c (lto_symtab_merge_decls_2): Don't diagnose type mismatch if the two types are built-in. Index: lto/lto-symtab.c =================================================================== --- lto/lto-symtab.c (revision 242823) +++ lto/lto-symtab.c (working copy) @@ -655,6 +655,14 @@ lto_symtab_merge_decls_2 (symtab_node *f /* Diagnose all mismatched re-declarations. */ FOR_EACH_VEC_ELT (mismatches, i, decl) { + /* Do not diagnose two built-in declarations, there is no useful + location in that case. It also happens for AVR if two built-ins + use the same asm name because their libgcc assembler code is the + same, see PR78562. */ + if (DECL_IS_BUILTIN (prevailing->decl) + && DECL_IS_BUILTIN (decl)) + continue; + int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl), TREE_TYPE (decl), DECL_COMDAT (decl));