From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9164 invoked by alias); 27 Oct 2004 17:01:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9071 invoked from network); 27 Oct 2004 17:01:22 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 27 Oct 2004 17:01:22 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id i9RH1LrC013019; Wed, 27 Oct 2004 13:01:21 -0400 Received: from vpn83-148.boston.redhat.com (vpn83-148.boston.redhat.com [172.16.83.148]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i9RH1Lr04616; Wed, 27 Oct 2004 13:01:21 -0400 Subject: Re: [PATCH] Fix PR tree-opt/17529, ICE due to *&a not being folded to a[0] From: Jeffrey A Law Reply-To: law@redhat.com To: Andrew Pinski Cc: GCC Patches In-Reply-To: <35DA558C-2559-11D9-8879-000A95D692F4@physics.uc.edu> References: <35DA558C-2559-11D9-8879-000A95D692F4@physics.uc.edu> Content-Type: text/plain Organization: Red Hat, Inc Date: Wed, 27 Oct 2004 17:10:00 -0000 Message-Id: <1098896479.5943.22.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-10/txt/msg02375.txt.bz2 On Sat, 2004-10-23 at 21:08 -0400, Andrew Pinski wrote: > I think the subject says what causes the problem and the reason why > we don't fold *&a into a[0] is because fold does not handle it > but fold_stmt does. We might consider moving this logic into the fold one day, but I suspect that's more intrusive than we want to tackle right now. > So what I did was to patch remove_useless_stmts_1 > to do the folding for us (this is already done for the second testcase > in the PR, for MODIFY_EXPR). I also removed the case for SWITCH_EXPR > in remove_useless_stmts_1 because it was not needed at all and just > slowed us down. > > OK? Bootstrapped and tested on powerpc-darwin. > > > > ChangeLog: > > * tree-cfg.c (remove_useless_stmts_1) : > Don't fold statement. > : Fold the statement. However, I don't think this will fix the other testcase in that PR: bar (const int *const x) { int x1 = *x; } static const int y[1]={0}; void foo (void) { bar (y); } [ Shouldn't this variant have a test in the testsuite as well? ] Which seems to indicate you're attacking this in the wrong place. Jeff