1 /* { dg-do compile } */
2 /* { dg-options "-O2 -funit-at-a-time" } */
3 /* { dg-final { scan-assembler-not "link_error" } } */
4 /*  In unit-at-time the functions should be assembled in order
5     e q t main, so we realize that they are pure.  */
6 
7 static int mem;
8 static int e(void) __attribute__ ((noinline));
9 static int q(void) __attribute__ ((noinline));
10 static int t(void) __attribute__ ((noinline));
main()11 main()
12 {
13 	return t();
14 }
t()15 static t()
16 {
17 	int r,e;
18 	if (mem)
19 		t();
20 	e=mem;
21 	r=q();
22 	if (e!=mem)
23 		link_error();
24 	return r;
25 }
e()26 static int e()
27 {
28 	return 0;
29 }
q()30 static int q()
31 {
32 	int t=mem,r;
33 	r=e();
34 	if (t!=mem)
35 		link_error();
36 	return r;
37 }
38