https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102683
--- Comment #5 from Qing Zhao <qing.zhao at oracle dot com> --- > --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- > But we should avoid > the .DEFERRED_INIT here. The GENERIC is > > struct C y; > <<cleanup_point <<< Unknown tree: expr_stmt > (void) (y = n == 1 ? TARGET_EXPR <D.1917, x> : TARGET_EXPR <D.1916, > {.c=__complex__ (3.0e+0, 3.0e+0)}>) >>>>>; > > so we have first > > stmt <decl_expr 0x7ffff6666da0 type <void_type 0x7ffff6558f18 void> > side-effects arg:0 <var_decl 0x7ffff7ff52d0 y> > t.i:10:5 start: t.i:10:5 finish: t.i:10:5> > > and then > > stmt <cleanup_point_expr 0x7ffff6666e00 type <void_type 0x7ffff6558f18 > void> > side-effects > arg:0 <expr_stmt 0x7ffff6666de0 type <void_type 0x7ffff6558f18 > void> > side-effects > arg:0 <convert_expr 0x7ffff6666dc0 type <void_type > 0x7ffff6558f18 void> > side-effects > arg:0 <init_expr 0x7ffff66810a0 type <record_type > 0x7ffff6663d20 C> > side-effects arg:0 <var_decl 0x7ffff7ff52d0 y> > arg:1 <cond_expr 0x7ffff66772d0 type <record_type > 0x7ffff6663d20 C> > ... > > so this is an INIT_EXPR which never(?) requires .DEFERRED_INIT? Of course > we're instrumenting the DECL_EXPR, not the INIT_EXPR and at that point > we didn't see the INIT_EXPR. Currently, in simplification phase, for each DECL_EXPR, we check: if (VAR_P (decl) && !DECL_EXTERNAL (decl)) { tree init = DECL_INITIAL (decl); If (!init. && is_var_need_auto_init (decl)) gimple_add_init_for_auto_var (decl…) We assume that FE will put the explicit initializer of a DECL to its DECL_INITIAL. Clearly for this testing case, this is not the case. I am wondering why FE does not put the initializer of this DECL to its DECL_INITIAL for this case? > > I wonder if we want a bit on DECL_EXPR denoting whether the decl is > fully initialized? Yes, if FE can mark this bit, it will be easier and simpler for the implementation.