delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/05/07:04:56

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT DELORIE DOT COM
Date: Wed, 5 Mar 1997 11:42:21 GMT
Subject: False alarm of variable used uninitialized
Message-ID: <408DFDF20F4@fs2.mt.umist.ac.uk>

C:\AM>type __.cc
#include<stdio.h>
void zxcvbnm(int A,int B){int C;
if(A==2 ?: (C=A+B)<5) return;
printf("%1d\n",C);}
/*-----*/
main(){zxcvbnm(5,6);;}

C:\AM>gcc __.cc -O2 -Wall
__.cc: In function `void zxcvbnm(int, int)':
__.cc:2: warning: `int C' might be used uninitialized in this function

There seems to be a logical fault in deciding when C `might be used
uninitialized in this function', as the if-branch `A==2' (which does not set
C) here leads straight to a return and not to anything mentioning C again.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019