On 12/16/2016 09:46 AM, Jakub Jelinek wrote:
On Fri, Dec 16, 2016 at 09:36:25AM -0700, Martin Sebor wrote:
It does for me with an allmodconf. At -O2 I get three warnings, and at
-O3 I get two additional warnings. Now these additional ones happen way
too deep into the pipeline to be reliable. (For a reduced testcase see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817#c8)
The warning looks quite justified in this case. The first call
to sm_read_sector exits with the pointer being null and so the
second call is diagnosed. That seems like a great example of
when the warning is useful.
No. The first call to sm_read_sector just doesn't exit. So it is warning
about dead code.
Correct. It's a false positive. Effectively the loop is never going to
terminate.
I don't claim it can't be improved but it seems pretty good as
it is already. Among the 6 instances it's found in GCC three
look like real bugs.
None look like real bugs to me.
But is the warning rate so high that we need to revert/reject the
warning as implemented. That's my question. 6 across GCC doesn't sound
bad across a multi-million line codebase.
jeff