This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix pattern causing C_MAYBE_CONST_EXPRs leak into gimplifier (PR c/68513)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Wed, 25 Nov 2015 15:16:53 +0000
- Subject: Re: [PATCH] Fix pattern causing C_MAYBE_CONST_EXPRs leak into gimplifier (PR c/68513)
- Authentication-results: sourceware.org; auth=none
- References: <20151125143509 dot GU21807 at redhat dot com> <20151125144620 dot GY5675 at tucnak dot redhat dot com>
On Wed, 25 Nov 2015, Jakub Jelinek wrote:
> But finding out if you have an expression on which c_fully_fold has been
> already called or not is non-trivial too.
The rule is that if the C front end needs to fold early for any reason
(e.g. for warnings) then the result of folding gets wrapped in a
C_MAYBE_CONST_EXPR as a signal that what's inside there doesn't need
folding again - or in another kind of tree that also isn't folded inside,
such as SAVE_EXPR or CALL_EXPR.
> Wonder if we couldn't use some FE specific bit on the SAVE_EXPR to say
> whether c_fully_fold_internal has already processed it or not, and just
> get rid of c_save_expr, in c_fully_fold* recurse into SAVE_EXPRs too, but
> only if that bit is not yet already set, and set it afterwards.
I suppose you could do that, in line with the general principle of
reducing early folding (as long as you ensure that folding the contents of
a SAVE_EXPR results in modifying that SAVE_EXPR so that all pointers to it
stay pointing to the same tree node).
--
Joseph S. Myers
joseph@codesourcery.com