Debian Codegraph @

gcc/testsuite/gcc.dg/pr105676.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wsuggest-attribute=pure" } */
3
4 __attribute__((const))
5 extern int do_expensive_calculation(void);
6
7 __attribute__((const))
8 int getval(void) /* { dg-bogus "candidate for attribute" } */
9 {
10 static int cache = -1;
11 if (cache == -1)
12 cache = do_expensive_calculation();
13 return cache;
14 }