From patchwork Mon Oct 22 19:25:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 193265 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]) by ozlabs.org (Postfix) with SMTP id 769F32C007B for ; Tue, 23 Oct 2012 06:25:56 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351538757; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=Li7weAF3EZoW9lPy5v/S 9yfNskc=; b=hJLFxg12LRWOriyNoIigOeXF9D4ilbpJqJqUlprPYev7RdCYonzc 3YYSlsxLzKy5VypjuohNgyrkQjVvRUltpjiuHt5ooI6Lvq7Q+vXQa5Q/9B4h09cn FIeWTHVH83GoyWgNIUq1Vh/ybiB0q38IjVrtsv/2/QaYk5QMfpqm0ys= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=L0CX/tbmxrNC0Nqzud/xNaUTeq3lcx8EBUI4BzfkMdu5hukwpJWGSgH0qx4lOZ h76cOKdgHu8t/PXiM/apun5b1i5kQjMW+4pDWBHbz8W3tx+0gNP/hjPJ6URFQ/gl 7Mn7mvLrj4wtVGOew7zHbjJLkolpkRuSVgDG4dsY9XH4E=; Received: (qmail 12935 invoked by alias); 22 Oct 2012 19:25:52 -0000 Received: (qmail 12925 invoked by uid 22791); 22 Oct 2012 19:25:51 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Oct 2012 19:25:47 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9MJPkPm008461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Oct 2012 15:25:47 -0400 Received: from zalov.redhat.com (vpn1-6-20.ams2.redhat.com [10.36.6.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9MJPiRc005255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Oct 2012 15:25:46 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q9MJPigj029117; Mon, 22 Oct 2012 21:25:44 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q9MJPiad029116; Mon, 22 Oct 2012 21:25:44 +0200 Date: Mon, 22 Oct 2012 21:25:44 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix cplus_decl_attributes (PR c++/54988) Message-ID: <20121022192544.GF1752@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! cplus_decl_attributes assumes that if attributes is NULL, there is nothing to do in decl_attributes, unfortunately that call can add implicit attributes based on currently active pragmas, at least for FUNCTION_DECLs. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-10-22 Jakub Jelinek PR c++/54988 * decl2.c (cplus_decl_attributes): Don't return early if attributes is NULL. * c-c++-common/pr54988.c: New test. Jakub --- gcc/cp/decl2.c.jj 2012-10-08 21:37:27.000000000 +0200 +++ gcc/cp/decl2.c 2012-10-22 12:43:04.994700609 +0200 @@ -1309,8 +1309,7 @@ void cplus_decl_attributes (tree *decl, tree attributes, int flags) { if (*decl == NULL_TREE || *decl == void_type_node - || *decl == error_mark_node - || attributes == NULL_TREE) + || *decl == error_mark_node) return; if (processing_template_decl) @@ -1319,8 +1318,6 @@ cplus_decl_attributes (tree *decl, tree return; save_template_attributes (&attributes, decl); - if (attributes == NULL_TREE) - return; } cp_check_const_attributes (attributes); --- gcc/testsuite/c-c++-common/pr54988.c.jj 2012-10-22 12:50:56.332853880 +0200 +++ gcc/testsuite/c-c++-common/pr54988.c 2012-10-22 12:50:04.000000000 +0200 @@ -0,0 +1,20 @@ +/* PR c++/54988 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ + +#if defined(__i386__) || defined(__x86_64__) +#pragma GCC target "fpmath=sse" +#endif + +static inline __attribute__ ((always_inline)) int +foo (int x) +{ + return x; +} + +int +bar (int x) +{ + return foo (x); +}