smbfs bug introduced at smbfs_vnops.c:1.58

Daniel Ellard ellard at eecs.harvard.edu
Sun Apr 10 04:46:02 PDT 2005


On Sun, 10 Apr 2005, Ulrich Spoerlein wrote:

> Date: Sun, 10 Apr 2005 11:24:17 +0200
> From: Ulrich Spoerlein <q at uni.de>
> To: takawata at jp.freebsd.org
> Cc: freebsd-fs at freebsd.org, bp at freebsd.org, jeff at freebsd.org,
>      freebsd-current at freebsd.org
> Subject: Re: smbfs bug introduced at smbfs_vnops.c:1.58
>
> On Sun, 10.04.2005 at 11:51:21 +0900, takawata at jp.freebsd.org wrote:
> > This is caused by uninitialized vp.
>
> The compiler should warn about this. But something fishy is going on ...
>
> foo.c:
> int main(void) {
>   int a;
>   a+=1;
>   return (0);
> }
>
> % gcc -O -W -Wall -Wuninitialized -Winit-self foo.c

Certainly this is undesireable, but from what I can tell this
happens because "a" is a dead variable and removed.  (Look at
the asm output and you'll see what I mean.)  So it's debatable
whether this is a bug.

If you change the -O to -g, then the code for "a" is not
removed -- but there's still no warning.  I think this is
a bug, because if the expression wasn't an innocuous a+=1
it could be a real problem if the variable wasn't removed.
But people will also argue about this..

-Dan



More information about the freebsd-current mailing list