Re: smbfs bug introduced at smbfs_vnops.c:1.58

From: Jens Schweikhardt <schweikh_at_schweikhardt.net>
Date: Sun, 10 Apr 2005 13:08:36 +0200
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)
Received on Sun Apr 10 2005 - 09:09:02 UTC

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