On Thu, Nov 26, 2015 at 05:05:09PM +0000, Joseph Myers wrote: > On Thu, 26 Nov 2015, Jakub Jelinek wrote: > > > > Also, on further consideration: the folding via c_fully_fold is relied > > > upon to get information about whether an expression contains anything > > > that > > > cannot occur in an evaluated part of a constant expression / outside > > > sizeof in a constant expression in C90 mode. So if a SAVE_EXPR is > > > created > > > by language-independent code, c_fully_fold doesn't see inside it and you > > > lose that information. What that says to me is that maybe a better > > > interim solution would be a lang hook for the folders to use to call > > > c_save_expr instead of save_expr. And then longer term: (a) maybe any > > > folding that involves duplicating expressions and so needs to create > > > > But the condition whether to call c_save_expr or whether to call save_expr > > instead is not constant in the C FE. > > If c_fully_fold is expected to be called on the expression, then c_save_expr > > needs to be used, otherwise save_expr. > > Can we rely on in_late_binary_op for that? > > Yes, I think so.
It seems only to be set temporarily when calling convert*, then reset back, while we supposedly want to use save_expr instead of c_save_expr also at the point where we are genericizing, or gimplifying etc. Jakub