1 /* Verify that only one DW_AT_const_value is emitted for baz,
2 not for baz abstract DIE and again inside of
3 DW_TAG_inlined_subroutine. */
4 /* { dg-options "-O2 -gdwarf -dA -fmerge-all-constants" } */
5 /* { dg-do compile } */
6 /* { dg-final { scan-assembler-times " DW_AT_const_value" 1 } } */
7
8 struct A { const long i; const long j; };
9
10 static inline long
foo(void)11 foo (void)
12 {
13 const struct A baz = { .i = 2, .j = 21 };
14 /* We must make sure that baz isn't optimized away before inlining,
15 otherwise its initializer is also lost. */
16 const struct A *p = &baz;
17 asm volatile ("" : : : "memory");
18 return baz.i * baz.j;
19 }
20
21 int
main()22 main ()
23 {
24 return foo () - 42;
25 }
26