This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/47444] False warning: array subscript is above array bounds


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]