From owner-cvs-src@FreeBSD.ORG Mon May 21 08:46:11 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A7A3D16A400; Mon, 21 May 2007 08:46:11 +0000 (UTC) (envelope-from bde@optusnet.com.au) Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199]) by mx1.freebsd.org (Postfix) with ESMTP id 4213A13C45A; Mon, 21 May 2007 08:46:11 +0000 (UTC) (envelope-from bde@optusnet.com.au) Received: from c211-30-216-190.carlnfd3.nsw.optusnet.com.au (c211-30-216-190.carlnfd3.nsw.optusnet.com.au [211.30.216.190]) by mail18.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l4L8k7cO004640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 May 2007 18:46:09 +1000 Date: Mon, 21 May 2007 18:46:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Matt Jacob In-Reply-To: <20070520212020.D71516@ns1.feral.com> Message-ID: <20070521181500.S56415@delplex.bde.org> References: <200705201649.l4KGnApl032671@repoman.freebsd.org> <20070521132204.D86236@besplex.bde.org> <20070520212020.D71516@ns1.feral.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/hptmv ioctl.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2007 08:46:11 -0000 On Sun, 20 May 2007 mjacob@FreeBSD.org wrote: >>> mjacob 2007-05-20 16:49:10 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> sys/dev/hptmv ioctl.c >>> Log: >>> Make gcc 4.2 happy by initiatlizing controller && channel prior >>> to a call to a function which *might* then initialize them. >>> >>> MFC after: 3 days >> >> Isn't the bug that the function doesn't always initialize them? > That was a meta-comment- I should have made it clearer. The function > get_disk_location *will* always init them, but gcc-4.2 doesn't know that, But the non-bug is still in the function and should be fixed and documented there, not in all callers. > and > unlike previous versions of gcc, gcc-4.2 no longer will assume that a > function that you pass a pointer to local data to will actually fill them in. No, gcc-4.2 isn't that broken. Initializing variables indirectly using init(&var1, &var1) is a C idiom and is used a lot, but gcc-4.2 only warns about a few such calls. A typical use is bzero(&var, sizeof(var)) to initialize a variable to all 0's. gcc-4.2 doesn't warn about this, and I think it wouldn't warn if you misspelled the size parameter so that the variable is only half initialized... I think gcc-4.2 only warns if it can look inside the function, and the function either doesn't initialize the variables or gcc cannot tell whether it does. In hptmv/ioctl.c, the problem is that the function searches a list and only initializes the variables if the list is non-empty. gcc cannot see if the list is non-empty, and neither can I. [mention of style bugs deleted] Bruce