1 /* m-un-1.c: "un" for "uninitialized" */ 2 3 /* 4 From: Jim Wilson <wilson@cygnus.com> 5 Date: Wed, 6 Jul 1994 13:11:47 -0700 6 To: dje@cygnus.com 7 Subject: Re: devo/gcc ChangeLog.fsf stmt.c 8 Cc: cvs-gcc@cygnus.com, tege@cygnus.com 9 10 How about a test case? :-) 11 12 Compile with -O -Wall and the broken compiler gives you: 13 tmp.c:6: warning: `k' might be used uninitialized in this function 14 The fixed compiler (and gcc 2.5.8) gives no warning. 15 16 This happens to fix a performance regression in the code generated for 17 while loops, but that is presumably much much harder to test for. 18 */ 19 20 /* { dg-do compile } */ 21 /* { dg-options "-O -Wall" } */ 22 23 int 24 sub () 25 { 26 int i = 0; 27 int j = 0; 28 int k; /* { dg-bogus "`k' might be used uninitialized" "uninitialized warning regression" } */ 29 30 while (i == 0 && j == 0) 31 { 32 k = 10; 33 i = sub (); 34 } 35 36 return k; 37 } 38