From owner-freebsd-current@FreeBSD.ORG Mon Jun 22 04:54:29 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37EB71065670; Mon, 22 Jun 2009 04:54:29 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id E735A8FC1A; Mon, 22 Jun 2009 04:54:28 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.3/8.14.3) with ESMTP id n5M4sS2b018133; Sun, 21 Jun 2009 21:54:28 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.3/8.14.3/Submit) id n5M4sS6S018132; Sun, 21 Jun 2009 21:54:28 -0700 (PDT) (envelope-from sgk) Date: Sun, 21 Jun 2009 21:54:28 -0700 From: Steve Kargl To: Adrian Chadd Message-ID: <20090622045428.GA18123@troutmask.apl.washington.edu> References: <20090621082022.GA88526@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Roman Divacky , current@freebsd.org Subject: Re: [PATCH]: if (cond); foo() in firewire X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 04:54:29 -0000 On Mon, Jun 22, 2009 at 12:04:49PM +0800, Adrian Chadd wrote: > 2009/6/21 Roman Divacky : > > hi > > > > is this patch correct? may I commit it? > > > > Index: ../../../dev/firewire/fwdev.c > > =================================================================== > > --- ../../../dev/firewire/fwdev.c       (revision 194573) > > +++ ../../../dev/firewire/fwdev.c       (working copy) > > @@ -443,7 +443,7 @@ > >        xfer->send.pay_len = uio->uio_resid; > >        if (uio->uio_resid > 0) { > >                if ((err = uiomove((caddr_t)&xfer->send.payload[0], > > -                   uio->uio_resid, uio))); > > +                   uio->uio_resid, uio))) > >                        goto out; > >        } > > > > > > another bug found by the "useless warnings in clang" ;) > > Is clang also evaluating all subsequent execution paths to tell you > what the change in program flow is? :) > > I hate to be the harbinger of evilness, but I'd at least attempt a > cursory glance at the code to make sure subsequent code is doing the > right thing. (It certainly looks like a vanilla userland transfer!) > > 2c, I agree with you. Nothing like side effects to screw up a persons clang. #include #include static int side_effect(int *i) { *i = 42; return 0; } int main(void) { int i; if (side_effect(&i)); if (i == 42) printf("%d\n", i); return 0; } -- Steve