https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107411

--- Comment #9 from qinzhao at gcc dot gnu.org ---
it's a bug in tree-ssa-uninit.cc actually.

when doing the following:

          /* Ignore the call to .DEFERRED_INIT that define the original
             var itself as the following case:
                temp = .DEFERRED_INIT (4, 2, “alt_reloc");
                alt_reloc = temp;
             In order to avoid generating warning for the fake usage
             at alt_reloc = temp.
          */

we need to compare the var name inside the .DEFERRED_INIT call (the 3nd
argument) and the name for the left side variable. if they are the same, we
will NOT report the warning. 

there is one issue when we get the name for the left side variable. when the
variable doesn't have a DECL_NAME (it's not a user declared variable, which is
the case for this bug):

>       _1 = .DEFERRED_INIT (4, 2, &"D.2389"[0]);
>       D.2389 = _1;

(in the above example, D.2389 is a variable that doesn't have a DECL_NAME.)

the current checking just ignores this case, and still report the warning. this
is incorrect.

The fix is very simple, when get the var name for the left side variable, we
should consider this case and come up with the name the same way as we
construct the 3rd argument for the call to .DEFERRED_INIT (please refer to the
routine "gimple_add_init_for_auto_var")

Reply via email to