This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57788] Waste work in maybe_deduce_size_from_array_init
- From: "pchang9 at cs dot wisc.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 02 Jul 2013 19:21:42 +0000
- Subject: [Bug c++/57788] Waste work in maybe_deduce_size_from_array_init
- Auto-submitted: auto-generated
- References: <bug-57788-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57788
--- Comment #1 from Po-Chun Chang <pchang9 at cs dot wisc.edu> ---
(In reply to Po-Chun Chang from comment #0)
> Created attachment 30427 [details]
> Suggested patch
>
> The problem appears in revision 200588 in version 4.9. I have attached a
> one-line patch that fixes it.
>
> In method "maybe_deduce_size_from_array_init()" in decl.c, the loop on line
> 4839 should break immediately after "failure" is set to 1. All the
> iterations after "failure" set to 1 do not perform any useful work, at best
> they just set "failure" again to 1.
Actual errors are reported as diagnostic inside the function
check_array_designated_initializer(), so the loop can't break prematurely.