This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79095] [7 regression] spurious stringop-overflow warning
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Jan 2017 00:28:32 +0000
- Subject: [Bug c++/79095] [7 regression] spurious stringop-overflow warning
- Auto-submitted: auto-generated
- References: <bug-79095-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79095
--- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> ---
I agree that calling v.resize(v.size() - 0) when v.size() is zero is a bug in
the program and diagnosing it should be a good thing (I think that corresponds
to the test case I pasted in comment #2 and what I based my patch with the trap
on.)
If your patch avoids the warning when the if guard in the test case in comment
#0 is uncommented that would seem like a fix.
As a separate change (in GCC 8) I do think it would be worth considering the
idea of inserting the trap, and also having tree-loop-distribution.c issue a
better warning when it detects an out of bounds loop like this one.