From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17045 invoked by alias); 26 Jun 2012 16:07:26 -0000 Received: (qmail 17017 invoked by uid 22791); 26 Jun 2012 16:07:23 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,TW_CF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jun 2012 16:07:11 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 090BF9B4B4; Tue, 26 Jun 2012 18:07:10 +0200 (CEST) Date: Tue, 26 Jun 2012 17:12:00 -0000 From: Michael Matz To: Jason Merrill Cc: Richard Guenther , Xinliang David Li , GCC Patches Subject: Re: New option to turn off stack reuse for temporaries In-Reply-To: <4FE9D23A.20000@redhat.com> Message-ID: References: <4FE26AFC.3000703@redhat.com> <4FE43AFD.6050601@redhat.com> <4FE9D23A.20000@redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes 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: 2012-06/txt/msg01699.txt.bz2 Hi, On Tue, 26 Jun 2012, Jason Merrill wrote: > > (the gimplifier code should be in Frontend code that lowers to GENERIC > > really and the WITH_CLEANUP_EXPR code should be C++ frontend specific > > ...). > > TARGET_EXPR has been a back-end code since the dawn of GCC version > control; if it's still only used by the C++ front end I guess it could > move to cp-tree.def, but we can't really lower it until gimplification > time because we need to strip away enclosing COMPOUND_EXPRs and such so > we can see that it's on the RHS of an initialization and optimize away > the temporary in that case. And now that GIMPLE isn't a subset of > GENERIC, we can't just use the gimplifier at genericization time. And > I'd rather not duplicate the entire gimplifier in the front end. I agree with Jason. TARGET_EXPR and CLEANUP_POINT_EXPR might currently be used only for C++, but I think they are sensible general constructs to be supported by the gimplifier. But I also think that the option to disable stack slot sharing should be moved to cfgexpand to trigger non-sharing of everything, not just these cleanup temporaries. After all using the (c++)temporary after expression end is a source bug that the option is supposed to work around, just like this is: char *p; { char str[50]; p = str; } use(p); So, IMO the option should also work around this source bug. We had at least one example of that in our own code base. Ciao, Michael.