aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr105676.c
blob: 077fc18a17f37a6a7a49b18ab52537a1d5040827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* { dg-do compile } */
/* { dg-options "-O2 -Wsuggest-attribute=pure" } */

__attribute__((const))
extern int do_expensive_calculation(void);

__attribute__((const))
int getval(void) /* { dg-bogus "candidate for attribute" } */
{
  static int cache = -1;
  if (cache == -1)
    cache = do_expensive_calculation();
  return cache;
}