[Bug tree-optimization/65178] incorrect -Wmaybe-uninitialized when using nested loops

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 3 01:26:00 GMT 2016


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

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Leon Winter from comment #7)
> Maybe a better solution is to hint the compiler that the loop body will be
> run at least once. A do-while seems to imply that (and the compiler does not
> print a warning).

Not for the minimized testcase. Unless you declare 'a' within the loop body,
which is not exactly equivalent.

If you declare it outside the loop body, gcc generates exactly the same code
for a 'for' and a 'do-while'.


More information about the Gcc-bugs mailing list