Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2005 13:08:36 +0200
From:      Jens Schweikhardt <schweikh@schweikhardt.net>
To:        takawata@jp.freebsd.org, jeff@freebsd.org, bp@freebsd.org, freebsd-fs@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: smbfs bug introduced at smbfs_vnops.c:1.58
Message-ID:  <20050410110836.GA1355@schweikhardt.net>
In-Reply-To: <20050410092417.GA774@galgenberg.net>
References:  <200504100251.j3A2pLEH055107@sana.init-main.com> <20050410092417.GA774@galgenberg.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 10, 2005 at 11:24:17AM +0200, Ulrich Spoerlein wrote:
# On Sun, 10.04.2005 at 11:51:21 +0900, takawata@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050410110836.GA1355>