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: 700385 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tSfbW5HCgz9ryk for ; Tue, 29 Nov 2016 21:16:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JRiVhF1/"; dkim-atps=neutral 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=cBomRxhRz7SMHgG9keg9M0aEvHdtan9NxZxutzYAl7RB1xw6bo eopaG5DMXL/Kwe3eJ2z1ewjIhyzpEIN7XDnQl82yzTB9czZVUAS5JFXZuY+7OtfS ryrmo8/m7QGOepyXUNq4ydfPxByVS4GqtbOcl6ETObIQbek3mXw+wVMoU= 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=JRiVhF1/U1PnFaEkwI84 1ooQh+riLkpmQUZ+8VD2RLcuQtTIf4qc4dqzFti19WknTLoLQdZHcp5EUZA6LMUi sncxu2mZw9QIGdo8XEiQ0o05WBks2M2BApFDlLtA9kr/fXMV95NeBNH5oaEiRM7o jAJir30xJV/aAgSO7iF/V/s= 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));