svn commit: r299588 - head/usr.sbin/binmiscctl
Don Lewis
truckman at FreeBSD.org
Fri May 13 16:42:40 UTC 2016
On 14 May, Bruce Evans wrote:
> On Fri, 13 May 2016, Don Lewis wrote:
>
>> Log:
>> Revert r299584:
>> Mark usage() as __dead2 so that Coverity doesn't think that execution
>> continues after the call and uses a negative array subscript.
>>
>> Requested by: bde
>
> Thanks.
>
> What was the problem that confused Coverity?
It sees that demux_cmd() can return -1. It takes the true branch
of "if (cmd == -1)" and calls usage. It then falls through and thinks
that cmds[] is getting indexed with a negative value on line 423.
Taking a closer look at the comments that Coverity added makes me wonder
if changing the test to "if (cmd < 0)" might unconfuse it.
> This reminds me that even compilers can see that usage() doesn't return,
> by looking ahead and even inlining usage(). This breaks debugging and
> profiling. clang doesn't support the -funit-at-a-time and
> -fno-inline-functions-called-once needed to reduce its excessive inlining.
More information about the svn-src-head
mailing list