This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix pattern causing C_MAYBE_CONST_EXPRs leak into gimplifier (PR c/68513)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]