Re: smbfs bug introduced at smbfs_vnops.c:1.58

From: Ulrich Spoerlein <q_at_uni.de>
Date: Sun, 10 Apr 2005 15:21:35 +0200
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?

Received on Sun Apr 10 2005 - 11:21:43 UTC

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