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

--- Comment #4 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to David Malcolm from comment #2)
> In https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106155#c12 do you mean a
> line like:
>     int emax = emax;
> ?

Yes.

> I've not seen self-initialization used to suppress "may be used
> uninitialized" in this way before.  Is there a style guide somewhere
> recommending this?

For GCC, this was suggested by Richard Biener in bug 36296 comment 3.

> I confess my first thought on seeing a line like:
> 
>    int i = i;
> 
> is that the compiler ought to issue some kind of warning for it.
> 
> Why not simply initialize it, say to 0 ?

Because this is not needed and may hide bugs and warnings if the code changes
(there should be a way to get a warning if the compiler can prove that the
variable is really uninitialized).

Reply via email to