From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11515 invoked by alias); 10 Jun 2011 08:35:49 -0000 Received: (qmail 11425 invoked by uid 22791); 10 Jun 2011 08:35:48 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 08:35:33 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 45C9690975; Fri, 10 Jun 2011 10:35:32 +0200 (CEST) Date: Fri, 10 Jun 2011 08:53:00 -0000 From: Richard Guenther To: Jason Merrill Cc: Richard Guenther , gcc-patches List Subject: Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)) In-Reply-To: <4DF11FBC.3010304@redhat.com> Message-ID: References: <4DEDB98F.6010508@redhat.com> <4DEE2DCF.7020905@redhat.com> <4DEE3484.8030101@redhat.com> <4DF11FBC.3010304@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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: 2011-06/txt/msg00804.txt.bz2 On Thu, 9 Jun 2011, Jason Merrill wrote: > On 06/07/2011 10:24 AM, Jason Merrill wrote: > > On 06/07/2011 10:05 AM, Richard Guenther wrote: > > > In that case you could do what Jakub suggested - but only for rvalues > > > of course. > > > > Right, and I need to handle lvalues as well. > > > > > Can't you instead adjust the type you feed to fold_indirect_ref_1 in > > > the caller in the C++ FE? > > > > Not without digging down into the operand to see what type it wants. At > > that point I might as well just copy the whole function into the FE. > > Ping? I'm out of good suggestions ;) You can do the same-qualifier matching and simply have a mismatched array element vs. array-ref type. We could also argue that whoever calls fold_indirect_ref_1 with TYPE that doesn't even have TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (op0 (!))) == TYPE_MAIN_VARIANT (type) is broken. Thus we could argue that even ignoring qualifiers is ok - but I'd be worried about folding *((volatile int *)&a[0] + 1) to a[1] with lost volatile qualification. Richard.