From patchwork Wed Aug 21 12:59:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1150834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507449-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xyMuR5Se"; dkim-atps=neutral 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 46D76409V0z9sDQ for ; Wed, 21 Aug 2019 22:59:21 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=l4ewVf00sjwhhwbl69yy5zd8kHgxj1/MfbKYgqV7VRM0qlPxugZp0 q8o2N60WPErXAv2X92tfHqvL/Wxv4YNpPjFnk1nrSSLXO/HOw7omkeebBfD7RoFJ MQkhK8oO8zeWMKRLwdOcEeWDPkwFlMlzk48L42U625AXjSD6ZNGZ4s= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=NEnzmb/BcStHP/t8v6oQzivcLgg=; b=xyMuR5SeNmN8fjT2w91r Tk+QBwLjX8Q1QzmxckHQEoS2/vGDYJint75Z5xbMnyKRUc4/rgpLO5d/xZl+8VE3 mUQir6YExHzR4CNSny2u1teqRjMjg1AjhOLk3LnHkIFfEP5dZvyHR6+vvpQZKjP0 Gp0LBH9Q2VjL/0kHM9e0twY= Received: (qmail 67512 invoked by alias); 21 Aug 2019 12:59:14 -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 67504 invoked by uid 89); 21 Aug 2019 12:59:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=afterward X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 12:59:13 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6181344 for ; Wed, 21 Aug 2019 05:59:11 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D4B63F718 for ; Wed, 21 Aug 2019 05:59:11 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [C++] Protect call to copy_attributes_to_builtin (PR91505) Date: Wed, 21 Aug 2019 13:59:10 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes copy_attributes_to_builtin only handles BUILT_IN_NORMAL, but C++ was calling it immediately after the: if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL) block. The corresponding C code calls it inside the block instead. Tested on x86_64-linux-gnu. OK to install? Richard 2019-08-21 Richard Sandiford gcc/cp/ PR c++/91505 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside the BUILT_IN_NORMAL block rather than afterward. gcc/testsuite/ PR c++/91505 * g++.target/i386/crc32-4.C: New test. Index: gcc/cp/decl.c =================================================================== --- gcc/cp/decl.c 2019-08-15 15:26:04.740237801 +0100 +++ gcc/cp/decl.c 2019-08-21 13:57:57.336587359 +0100 @@ -2565,9 +2565,9 @@ duplicate_decls (tree newdecl, tree oldd set_builtin_decl_declared_p (fncode, true); break; } - } - copy_attributes_to_builtin (newdecl); + copy_attributes_to_builtin (newdecl); + } } if (new_defines_function) /* If defining a function declared with other language Index: gcc/testsuite/g++.target/i386/crc32-4.C =================================================================== --- /dev/null 2019-07-30 08:53:31.317691683 +0100 +++ gcc/testsuite/g++.target/i386/crc32-4.C 2019-08-21 13:57:57.336587359 +0100 @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx2" } */ + +#include "../../gcc.target/i386/crc32-4.c"