> Umm, I think most of them (if not all) are just bogus. If a FE doesn't > want to fold some stuff when at global scope it should not call fold.
That isn't so easy because fold is invoked on sizes of types by stor-layout.c and these sizes can be variable (at least in Ada). So I think that the calls to the hook are still needed. But: 1) The -1 thing should go and the hook return boolean. The prerequisite is to tidy up variable_size, 2) I think that the GIMPLE hook can return 0 unconditionally. > But I'm not sure that is actually what it tries to do ... and the existing > checks are far from consistently spread out in fold-const.c ... It prevents save_expr from being called at global level, since you cannot create SAVE_EXPRs outside functions. Likewise in variable_size. -- Eric Botcazou