[Bug middle-end/36296] bogus uninitialized warning (loop representation, VRP missed-optimization)
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 17 11:31:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296
--- Comment #22 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-04-17 11:31:29 UTC ---
(In reply to comment #20)
> (In reply to comment #18)
> > In fact, we should have removed the i=i idiom a long time ago. The correct
> > thing to do (as Linus says) is to initialize the variable to a sensible value
> > to silence the warning: http://lwn.net/Articles/529954/
>
> There is no real sensible value except some trap value. Letting the variable
> uninitialized at that point (the declaration) allows some tools, like the
> Formalin compiler described in WG14/N1637, to detect potential problems if the
> variable is really used uninitialized.
That doesn't contradict my assessment above that i=i idiom should die. With the
Pragma one can choose to ignore GCC warnings if they don't want to initialize
the value.
The trap value would be an additional improvement, but someone needs to
implement it. Clang has fsanitize=undefined-trap:
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
More information about the Gcc-bugs
mailing list