xref: /openbsd-src/gnu/usr.bin/gcc/gcc/testsuite/gcc.dg/debug/debug-5.c (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1 /* This testcase failed, because scope containing baz was deleted
2    (spanned 0 basic blocks) and DWARF-2 couldn't find baz origin.  */
3 /* { dg-do compile } */
4 
5 extern void abort (void);
6 
7 struct A { char *a, *b, *c, *d; };
8 
9 static int
bar(struct A * x)10 bar (struct A *x)
11 {
12   return x->c - x->b;
13 }
14 
15 static int
bar2(struct A * x)16 bar2 (struct A *x)
17 {
18   int a = x->c - x->b;
19   x->c += 26;
20   return a;
21 }
22 
23 void fnptr (void (*fn) (void));
24 
25 void
foo(void)26 foo (void)
27 {
28   struct A e;
29 
30   if (bar2 (&e) < 0)
31     abort ();
32   {
33     void baz (void)
34       {
35 	bar (&e);
36       }
37     fnptr (baz);
38   }
39   {
40     struct A *f;
41 
42     f = &e;
43     if (f->c - f->a > f->d - f->a)
44       f->c = f->d;
45   }
46 }
47