Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / m-un-1.c
blobad84d44ca1512faca1e7d6cece1b5097d89a8455
1 /* m-un-1.c: "un" for "uninitialized" */
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
10 How about a test case? :-)
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.
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.
20 /* { dg-do compile } */
21 /* { dg-options "-O -Wall" } */
23 int
24 sub ()
26 int i = 0;
27 int j = 0;
28 int k; /* { dg-bogus "`k' might be used uninitialized" "uninitialized warning regression" } */
30 while (i == 0 && j == 0)
32 k = 10;
33 i = sub ();
36 return k;