From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17448 invoked by alias); 23 Jan 2008 21:14:50 -0000 Received: (qmail 17437 invoked by uid 22791); 23 Jan 2008 21:14:50 -0000 X-Spam-Check-By: sourceware.org Received: from caip.rutgers.edu (HELO caip.rutgers.edu) (128.6.236.16) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Jan 2008 21:14:22 +0000 Received: from caipclassic.rutgers.edu (caipclassic.rutgers.edu [128.6.237.54]) by caip.rutgers.edu (8.13.8/8.13.5) with ESMTP id m0NLA5YS017933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Jan 2008 16:10:05 -0500 Date: Thu, 24 Jan 2008 01:09:00 -0000 From: "Kaveh R. GHAZI" To: Nathan Froyd cc: gcc-patches@gcc.gnu.org, janis187@us.ibm.com, zadeck@naturalbridge.com, rguenther@suse.de Subject: Re: [PATCH,testsuite] fix gcc.dg/tree-ssa/20030714-1.c with -fPIC In-Reply-To: <20070726211317.GA32033@sparrowhawk.codesourcery.com> Message-ID: References: <20070726211317.GA32033@sparrowhawk.codesourcery.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 X-SW-Source: 2008-01/txt/msg01118.txt.bz2 The testcase gcc.dg/tree-ssa/20030714-1.c is failing on the branches with -fpic/-fPIC and this failure is a regression (apparently intentional) from previous 4.x gcc. More analysis below. The test seems to rely on the code being automatically marked pure/const by gcc during compilation. Mainline is okay because the failing scans in the test were removed as part of the fix for PR33826 by Kenny. In that PR, it was decided that recursive function must not be considered for automatic pure/const marking. So now the testcase on mainline passes regardless of pic or nonpic, because the checks have been truncated to fit into this new requirement. On the branches, the testcase still does the original checks and gcc still allows recursive functions to become pure/const. And it passes in the regular default case. However a change was made by Richard G. to ensure this optimization happens only if the functions bind locally. With -fpic/-fPIC the function doesn't bind locally and the error pops up. Nathan proposed a fix to the testcase here in July: http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01948.html but I don't see that it ever got reviewed or installed. I believe Nathan's solution is correct in that he makes the function static so it binds locally. By doing so, (and using a global wrapper to get the dump) it works for -fpic/-fPIC. Another option would be to backport Kenny's patch for PR33826 which as a side-effect would cure this failure by removing the scans. This might be the correct thing to do given the analysis in the PR, however it is also more intrusive. I haven't bootstrapped Kenny's patch on the branches to make sure it doesn't break anything, but I will if people think it's a better option. Thoughts on the best way to go? Thanks, --Kaveh -- Kaveh R. Ghazi ghazi@caip.rutgers.edu