Debian Codegraph @

gcc/testsuite/c-c++-common/guality/Og-dce-3.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-g" } */
3
4 volatile int amount = 10;
5
6 void __attribute__((noipa))
7 do_something (int *ptr)
8 {
9 *ptr += 10;
10 }
11
12 int __attribute__((noipa))
13 foo (int count)
14 {
15 int x = 1;
16 for (int i = 0; i < count; ++i)
17 do_something (&x); /* { dg-final { gdb-test . "x" "1" } } */
18 int res = x; /* { dg-final { gdb-test . "x" "101" } } */
19 x = res + 1;
20 return res; /* { dg-final { gdb-test . "x" "102" } } */
21
22 }
23
24 int
25 main (void)
26 {
27 foo (10);
28 return 0;
29 }