On Tue, Mar 06, 2018 at 02:28:40AM -0300, Alexandre Oliva wrote: > On Mar 5, 2018, Jakub Jelinek <ja...@redhat.com> wrote: > > > * tree.c (stabilize_reference_1): Return save_expr (e) for > > STATEMENT_LIST even if it doesn't have side-effects. > > I'm concerned about codegen differences in case the statement list is > created because of debug stmts not present in a nondebug compile. > Wouldn't this make the nondebug compile not have a save_expr at all, > which would then likely cause different code to be generated with the > save_expr in one case and no save_expr in the other? I guess the > compare-debug would have flagged any such differences, so I suppose my > concerns are unfounded, and in case they aren't, we'll soon find out ;-) > So, no objections from me; thanks for looking into this!
Yes, I was concerned, but couldn't create a testcase that would fail with -fcompare-debug nor the bootstrap has found anything. And note that the concerns weren't primarily about the SAVE_EXPRs, but about the preexisting gimplification of the STATEMENT_LIST vs. gimplification of just the last statement of it, where the former creates retval.N temporary and thus if we managed to preserve some retval.M temporary till the final dumps, it would be different for -fcompare-debug. If we ever hit that issue, one way out of it would be to gimplify STATEMENT_LIST without TREE_SIDE_EFFECTS that contain only some optional DEBUG_BEGIN_STMTs and a single other stmt differently, either but not generating the temporary at all, or by forcing it to be nameless. And SAVE_EXPRs can in theory have the same issue, they use get_initialized_tmp_var with !allow_ssa, for ({ 0; }) and similar that creates a nameless temporary decl, which is what we want and shouldn't affect anything, but if we have say ({ i; }) or ({ &j; }), then those can get a name. So, we'd need to force creation of non-cached (lookup_tmp_var) nameless temporary for SAVE_EXPRs that contain the above described STATEMENT_LISTs. Maybe a better fix if we run into this would be to make create_tmp_var_raw create DECL_NAMELESS decls and make sure we don't print names of DECL_NAMELESS variables in -fdump-final-insns= dumps? I mean the fancy names are causing us trouble all the time, e.g. the SRA fancy names that later get concatenated to other fancy names and sometimes contains uids... Jakub