From owner-svn-src-all@freebsd.org Fri May 13 16:42:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2A02B3A9FC; Fri, 13 May 2016 16:42:40 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A0DCF1005; Fri, 13 May 2016 16:42:40 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id u4DGgUt5060836; Fri, 13 May 2016 09:42:34 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201605131642.u4DGgUt5060836@gw.catspoiler.org> Date: Fri, 13 May 2016 09:42:30 -0700 (PDT) From: Don Lewis Subject: Re: svn commit: r299588 - head/usr.sbin/binmiscctl To: brde@optusnet.com.au cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <20160514013315.K1048@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2016 16:42:40 -0000 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.