Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/uninit-25.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-options "-O -Wmaybe-uninitialized" } */ | |
3 | |
4 extern unsigned bar (void); | |
5 extern void quux (void); | |
6 | |
7 unsigned foo (unsigned v) | |
8 { | |
9 unsigned u; | |
10 if (v != 1) | |
11 u = bar (); | |
12 | |
13 // Prevent the "dom" pass from changing the CFG layout based on the inference | |
14 // 'if (v != 1) is false then (v != 2) is true'. (Now it would have to | |
15 // duplicate the loop in order to do so, which is deemed expensive.) | |
16 for (int i = 0; i < 10; i++) | |
17 quux (); | |
18 | |
19 if (v != 2) | |
20 return u; /* { dg-warning "may be used uninitialized" } */ | |
21 | |
22 return 0; | |
23 } |