From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23179 invoked by alias); 16 Jun 2014 09:06:11 -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 23158 invoked by uid 89); 16 Jun 2014 09:06:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 16 Jun 2014 09:06:07 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 6542B54428F; Mon, 16 Jun 2014 11:06:04 +0200 (CEST) Date: Mon, 16 Jun 2014 09:06:00 -0000 From: Jan Hubicka To: Rich Felker Cc: Alexander Monakov , Jeff Law , Richard Biener , Jan Hubicka , GCC Patches Subject: Re: [PATCH] proposed fix for bug # 61144 Message-ID: <20140616090604.GB14894@kam.mff.cuni.cz> References: <20140521015948.GA21600@brightrain.aerifal.cx> <20140522035942.GG507@brightrain.aerifal.cx> <537F92CA.8090808@redhat.com> <20140606171424.GC179@brightrain.aerifal.cx> <20140609184601.GI179@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140609184601.GI179@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-06/txt/msg01232.txt.bz2 > > Are the attached files acceptable? The testcase looks OK to me, but it already should be fixed on mainline by patch https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01315.html that prevents dummy to be marked as constant. You can however modify the testcase to have __attribute__ ((weak)) const int foo=0; This needs your decl_replaceable change to not be optimized to if (0), because of the explicit const modifier. I did not change ctor_for_folding to reject variables above as I was not quite sure we want to support this kind of interposition and I am still not quite certain. C++ is quite clear about the transformation replacing initialized const by its value. Honza > > Rich > /* { dg-do run } */ > /* { dg-require-weak "" } */ > /* { dg-require-alias "" } */ > /* { dg-additional-sources "wkali-3a.c" } */ > > #include > > static int dummy = 0; > extern int foo __attribute__((__weak__, __alias__("dummy"))); > > int main(void) { > > if (foo) > exit(0); > else > abort(); > } > /* { dg-do run } */ > > int foo = 1;