This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47444] False warning: array subscript is above array bounds
- 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: Tue, 25 Jan 2011 12:58:17 +0000
- Subject: [Bug c++/47444] False warning: array subscript is above array bounds
- Auto-submitted: auto-generated
- References: <bug-47444-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47444
--- Comment #5 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2011-01-25 12:58:12 UTC ---
(In reply to comment #4)
> Well. You might argue that the wording should be 'may be' in all cases
> where the offending statement might not be executed (which is certainly
> undecidable as you can't know whether the function is executed at all).
> But it also isn't the way we handle other warnings (in particular the
> uninitialized variable uses).
This is strange. We *precisely* says "is uninitialized" when it can be proved
that it happens and "may be uninitialized" when it is just some code-paths or
we cannot prove that it doesn't happen. And we certainly (or used to, I haven't
been following these bugs lately) classify as bugs when the wrong message is
printed.
> Thus I think we should not fix this bug (and it is a non-bug, as certainly
> the code in question isn't obviously dead).
>
> Interprocedual analysis could see that we call the function with a boolean
> value (thus, either 0 or 1).
>
> That said - we can't suit everyone with this kind of warnings.
Then I guess we should just point out people to static analysis tools, like
http://clang-analyzer.llvm.org/, which are more suited for this task than GCC.