Debian Codegraph @

gcc/testsuite/gcc.c-torture/compile/20030405-1.c

raw
1 /* When compiled with -pedantic, this program will cause an ICE when the
2 constant propagator tries to set the value of *str to UNDEFINED.
3
4 This happens because *str is erroneously considered as a store alias.
5 The aliasing code is then making *str an alias leader for its alias set
6 and when the PHI node at the end of the while() is visited the first
7 time, CCP will try to assign it a value of UNDEFINED, but the default
8 value for *str is a constant. */
9 typedef __SIZE_TYPE__ size_t;
10 size_t strlength (const char * const);
11 char foo();
12
13 static const char * const str = "mingo";
14
15 int
16 bar(void)
17 {
18 size_t c;
19 char *x;
20
21 c = strlength (str);
22 while (c < 10)
23 {
24 if (c > 5)
25 *x = foo ();
26 if (*x < 'a')
27 break;
28 }
29
30 return *x == '3';
31 }