aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c
blob: 569e5e237d926570b4dcb3d36b7161e1e02c4367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O0 -gctf -dA" } */

/* This tests the following scenario:

   1. struct foo;
   2. struct foo *a_foo;
   3. struct foo { int bar; };
   4. void baz (struct foo **f) { f->bar = 0; }

   At 2. a forward for struct foo is generated and at 3. the struct
   type is fully defined.  When a pointer to a pointer to foo is
   encountered at 4., an additional CTF type for the completed struct
   shall be emitted as well.  The linker will deduplicate both
   types.  */

struct foo;
struct foo *a_foo;
struct foo { int bar; };
void baz (struct foo **f) { (*f)->bar = 0; }

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