Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr90348.c

raw
1 /* PR middle-end/90348 */
2
3 void __attribute__ ((noipa))
4 set_one (unsigned char *ptr)
5 {
6 *ptr = 1;
7 }
8
9 void __attribute__ ((noipa))
10 check_zero (unsigned char const *in, unsigned int len)
11 {
12 for (unsigned int i = 0; i < len; ++i)
13 if (in[i] != 0)
14 __builtin_abort ();
15 }
16
17 static void
18 set_one_on_stack (void)
19 {
20 unsigned char buf[1];
21 set_one (buf);
22 }
23
24 int
25 main ()
26 {
27 for (int i = 0; i <= 4; ++i)
28 {
29 unsigned char in[4];
30 for (int j = 0; j < i; ++j)
31 {
32 in[j] = 0;
33 set_one_on_stack ();
34 }
35 check_zero (in, i);
36 }
37 return 0;
38 }