smbfs bug introduced at smbfs_vnops.c:1.58

Ulrich Spoerlein q at uni.de
Sun Apr 10 06:21:43 PDT 2005


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.
> 
> 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..

You are right, using something like this:

#include <stdio.h>
int main(void) {
  int a,b;
  a+=1;
  b=1+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örlein
-- 
 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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20050410/f23af906/attachment.bin


More information about the freebsd-fs mailing list