From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4386 invoked by alias); 9 Jun 2014 11:41:33 -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 4373 invoked by uid 89); 9 Jun 2014 11:41:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.ispras.ru Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.199.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jun 2014 11:41:30 +0000 Received: from [10.10.3.121] (unknown [83.149.199.91]) by smtp.ispras.ru (Postfix) with ESMTP id 2912E224C3; Mon, 9 Jun 2014 15:41:25 +0400 (MSK) Date: Mon, 09 Jun 2014 11:41:00 -0000 From: Alexander Monakov To: Rich Felker cc: Jeff Law , Richard Biener , Jan Hubicka , GCC Patches Subject: Re: [PATCH] proposed fix for bug # 61144 In-Reply-To: <20140606171424.GC179@brightrain.aerifal.cx> Message-ID: References: <20140521015948.GA21600@brightrain.aerifal.cx> <20140522035942.GG507@brightrain.aerifal.cx> <537F92CA.8090808@redhat.com> <20140606171424.GC179@brightrain.aerifal.cx> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2014-06/txt/msg00709.txt.bz2 On Fri, 6 Jun 2014, Rich Felker wrote: > On Fri, May 23, 2014 at 12:26:18PM -0600, Jeff Law wrote: > > On 05/21/14 21:59, Rich Felker wrote: > > >On Wed, May 21, 2014 at 11:17:53AM +0200, Richard Biener wrote: > > >>On Wed, May 21, 2014 at 3:59 AM, Rich Felker wrote: > > >>>Bug # 61144 is a regression in 4.9.0 that breaks building of musl libc > > >>>due to aggressive and semantically-incorrect constant folding of weak > > >>>aliases. The attached patch seems to fix the issue. A weak alias > > >>>should never be a candidate for constant folding because it may always > > >>>be replaced by a strong definition from another translation unit. > > >>> > > >>>For details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61144 > > >>> > > >>>I do not have a copyright assignment on file but this patch should be > > >>>sufficiently trivial not to require it. > > >> > > >>Please add a testcase. Also I wonder why it isn't better to generalize > > > > > >How should a testcase be done? On the PR there's a testcase that shows > > >the problem in the generated code, but no automated check for it. > > >Testing this is actually a bit of a pain unless you're allowed to run > > >the generated program. > > You can run the test program. Have it exit (0) on success, abort () > > on failure if at all possible. Then drop the test source file into > > gcc/testsuite/gcc.c-torture/execute/pr61144.c > > The test needs to be two translation units linked together: one with > a weak definition of the object as 0, and the other with a strong > definition. The test should show the weak value being used rather than > the strong one. But I'm not sure how this should be integrated with > the build process. Please have a look at gcc/testsuite/gcc.dg/special/wkali-2{,a,b}.c. This is a three-TU test for weak aliases, so you should be able to very easily adjust it for this bug. Thanks. Alexander