From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13604 invoked by alias); 23 Jul 2014 09:00:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13521 invoked by uid 89); 23 Jul 2014 09:00:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 23 Jul 2014 09:00:34 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6N90W4J007877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jul 2014 05:00:32 -0400 Received: from oldenburg.str.redhat.com (oldenburg.str.redhat.com [10.33.200.60]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6N90TEl027891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 23 Jul 2014 05:00:30 -0400 Message-ID: <53CF79AD.8020905@redhat.com> Date: Wed, 23 Jul 2014 09:06:00 -0000 From: Florian Weimer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Alexander Monakov , Jan Hubicka CC: Rich Felker , Richard Biener , GCC Patches Subject: Re: [PATCH] proposed fix for bug # 61144 References: <20140521015948.GA21600@brightrain.aerifal.cx> <20140522035942.GG507@brightrain.aerifal.cx> <20140616085601.GA14894@kam.mff.cuni.cz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg01493.txt.bz2 On 07/22/2014 07:17 PM, Alexander Monakov wrote: > On Tue, 22 Jul 2014, Alexander Monakov wrote: >> I'd like to push this topic forward a bit. I've bootstrapped and regtested a >> version of the patch based on the initial proposal to check DECL_WEAK. The >> approach with decl_replaceable_p looks not that easy; I'll expand in a >> followup email. > > The problem with the patch below using decl_replaceable_p is that it regresses > the following C++ testcase: > > struct z { > static const int aaa = 1; > }; > > //const int z::aaa; > > int foo(int x) > { > return x ? z::aaa : x; > } > > Here decl_replaceable_p is 'true' for z::aaa. With the patch the reference to > z::aaa is not folded, but its definition is not emitted either, so a undefined > reference error is produced at link time. Technically, this is not a bug (for C++03 at least). But I do think folding the constant is an important optimization. -- Florian Weimer / Red Hat Product Security