1 /* { dg-do compile } */
2 /* { dg-options "-Wno-attributes -fdiagnostics-show-caret -O1" } */
3
4 extern void __emit_warning (const char *message);
5
6 __attribute__((always_inline))
foo(void)7 static void foo (void)
8 {
9 __emit_warning ("message");
10 }
11
12 __attribute__((always_inline))
bar(void)13 static void bar (void)
14 {
15 foo ();
16 }
17
main()18 int main()
19 {
20 bar ();
21 return 0;
22 }
23
24 /* Reproducer for PR tree-optimization/83336: when optimization is
25 enabled, but debuginfo isn't, the diagnostics subsystem doesn't
26 report the full inlining chain at a middle-end warning.
27
28 This is a copy of diagnostic-test-inlining-1.c, but with -O1.
29
30 Ideally the diagnostics subsystem would report:
31 In function 'foo', inlined from 'bar' at LOC A, inlined from 'main' at LOC B:
32 but with -O1 it only reports:
33 In function 'foo', inlined from 'main' at LOC A:
34
35 This test case captures this behavior. */
36
37 /* { dg-regexp "In function 'foo'," "" } */
38 /* { dg-regexp " inlined from 'main' at .+/diagnostic-test-inlining-3.c:15:3:" "" } */
39 /* { dg-warning "3: message" "" { target *-*-* } 9 } */
40 /* { dg-begin-multiline-output "" }
41 __emit_warning ("message");
42 ^~~~~~~~~~~~~~~~~~~~~~~~~~
43 { dg-end-multiline-output "" } */
44