[Bug analyzer/122055] -Wanalyzer-use-of-uninitialized-value false positive with self initialization and no optimizations
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 17 19:55:41 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122055
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug report.
In https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106155#c12 do you mean a line
like:
int emax = emax;
?
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?
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 ?
Sorry if I'm missing something here
More information about the Gcc-bugs
mailing list