annotate gcc/testsuite/gcc.dg/m-un-1.c @ 145:1830386684a0

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