gcc/testsuite/gcc.dg/tree-ssa/modref-14.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wsuggest-attribute=const" } */ |
| 3 | struct a {int a,b,c;}; |
| 4 | __attribute__ ((noinline)) |
| 5 | int init (struct a *a) |
| 6 | { |
| 7 | a->a=1; |
| 8 | a->b=2; |
| 9 | a->c=3; |
| 10 | } |
| 11 | int const_fn () /* { dg-warning "function might be candidate for attribute 'const" } */ |
| 12 | { |
| 13 | struct a a; |
| 14 | init (&a); |
| 15 | return a.a + a.b + a.c; |
| 16 | } |