Re: smbfs bug introduced at smbfs_vnops.c:1.58

From: Daniel Ellard <ellard_at_eecs.harvard.edu>
Date: Sun, 10 Apr 2005 07:45:50 -0400 (EDT)
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
Received on Sun Apr 10 2005 - 09:46:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:31 UTC