smbfs bug introduced at smbfs_vnops.c:1.58

Jens Schweikhardt schweikh at schweikhardt.net
Sun Apr 10 04:09:02 PDT 2005


On Sun, Apr 10, 2005 at 11:24:17AM +0200, Ulrich Spoerlein wrote:
# 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);
# }

Not so fishy. No warning because -O completely optimizes 'a' away. Try
this instead:

$ cat foo.c
int main(void) {
  int a;
  a+=1;
  return a;
}
$ gcc -O -W -Wall -Wuninitialized -Winit-self foo.c
foo.c: In function `main':
foo.c:2: warning: 'a' might be used uninitialized in this function


Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)


More information about the freebsd-fs mailing list