1 /* PR rtl-optimization/28243 */
2 /* Reported by Mike Frysinger <vapier@gentoo.org> */
3 
4 /* { dg-do compile } */
5 /* { dg-require-effective-target fpic } */
6 /* { dg-options "-O2 -ftracer -fPIC" } */
7 /* { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } } */
8 
9 struct displayfuncs {
10   void (*init) ();
11 } funcs;
12 
13 struct gpsdisplay {
14   struct displayfuncs *funcs;
15 };
16 
17 void PSDoArc ();
18 
PSMyArc(double cx,double cy,double radx,double rady,double sa,double ta)19 static void PSMyArc(double cx, double cy, double radx, double rady, double sa,
20 		    double ta)
21 {
22   double ea;
23   double temp;
24   ea = sa + ta;
25   while (sa < ea) {
26     temp = ((sa + 90) / 90) * 90;
27     PSDoArc(cx, sa, ea < temp ? ea : temp);
28     sa = temp;
29   }
30 }
31 
PSDrawElipse()32 static void PSDrawElipse()
33 {
34   float cx;
35   float cy;
36   float radx;
37   float rady;
38   if (radx != rady)
39     PSMyArc(cx, cy, radx, rady, 0, 360);
40 }
41 
PSDrawFillCircle()42 static void PSDrawFillCircle()
43 {
44   PSDrawElipse();
45 }
46 
47 static struct displayfuncs psfuncs[] = {
48   PSDrawFillCircle
49 };
50 
_GPSDraw_CreateDisplay()51 void _GPSDraw_CreateDisplay()
52 {
53   struct gpsdisplay *gdisp;
54   gdisp->funcs = (void *)&psfuncs;
55 }
56