aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c
blob: a683113e505e4cdd49accd0cce619e142b61acc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* CTF is not generated for entities not at file-scope.  */

/* { dg-do compile )  */
/* { dg-options "-O0 -gctf -dA" } */

/* { dg-final { scan-assembler-times "ascii \"SFOO.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
/* { dg-final { scan-assembler-times "ascii \"gfoo.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */

int foo (int n)
{
  typedef struct { int a[n]; } SFOO;

  SFOO a;
  __attribute__ ((noinline)) SFOO gfoo (void) { return a; }

  a.a[0] = 1;
  a.a[9] = 2;

  SFOO b;
  b = gfoo ();

  return b.a[0] == 1 && b.a[9] == 2;
}