Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Apr 2005 15:21:35 +0200
From:      Ulrich Spoerlein <q@uni.de>
To:        Daniel Ellard <ellard@eecs.harvard.edu>
Cc:        freebsd-current@freebsd.org
Subject:   Re: smbfs bug introduced at smbfs_vnops.c:1.58
Message-ID:  <20050410132135.GB774@galgenberg.net>
In-Reply-To: <20050410074009.N66651@bowser.eecs.harvard.edu>
References:  <200504100251.j3A2pLEH055107@sana.init-main.com> <20050410092417.GA774@galgenberg.net> <20050410074009.N66651@bowser.eecs.harvard.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--7ZAtKRhVyVSsbBD2
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, 10.04.2005 at 07:45:50 -0400, Daniel Ellard wrote:
> 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.
>=20
> 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+=3D1
> it could be a real problem if the variable wasn't removed.
> But people will also argue about this..

You are right, using something like this:

#include <stdio.h>
int main(void) {
  int a,b;
  a+=3D1;
  b=3D1+a;
  printf("%d\n", b);
  return (0);
}

I get a warning:
% cc -O -W -Wall -Wuninitialized foo.c
foo.c: In function `main':
foo.c:3: warning: 'a' might be used uninitialized in this function

Sorry for the noise then. /me needs to learn asm some day.

Ulrich Sp=F6rlein
--=20
 PGP Key ID: F0DB9F44				Encrypted mail welcome!
Fingerprint: F1CE D062 0CA9 ADE3 349B  2FE8 980A C6B5 F0DB 9F44
Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
didn't you understand?

--7ZAtKRhVyVSsbBD2
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQFCWShfmArGtfDbn0QRAiE8AJ9+UpRfN2zL4Pgj9lvXsDx8LLQKcACgxgv6
6mXAFnU8+XSLDHhh8FL2YqY=
=KQlv
-----END PGP SIGNATURE-----

--7ZAtKRhVyVSsbBD2--



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