This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/65178] incorrect -Wmaybe-uninitialized when using nested loops
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 03 Mar 2016 01:26:26 +0000
- Subject: [Bug tree-optimization/65178] incorrect -Wmaybe-uninitialized when using nested loops
- Auto-submitted: auto-generated
- References: <bug-65178-4 at http dot gcc dot gnu dot org/bugzilla/>
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'.