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 
8 struct displayfuncs {
9   void (*init) ();
10 } funcs;
11 
12 struct gpsdisplay {
13   struct displayfuncs *funcs;
14 };
15 
16 void PSDoArc ();
17 
PSMyArc(double cx,double cy,double radx,double rady,double sa,double ta)18 static void PSMyArc(double cx, double cy, double radx, double rady, double sa,
19 		    double ta)
20 {
21   double ea;
22   double temp;
23   ea = sa + ta;
24   while (sa < ea) {
25     temp = ((sa + 90) / 90) * 90;
26     PSDoArc(cx, sa, ea < temp ? ea : temp);
27     sa = temp;
28   }
29 }
30 
PSDrawElipse()31 static void PSDrawElipse()
32 {
33   float cx;
34   float cy;
35   float radx;
36   float rady;
37   if (radx != rady)
38     PSMyArc(cx, cy, radx, rady, 0, 360);
39 }
40 
PSDrawFillCircle()41 static void PSDrawFillCircle()
42 {
43   PSDrawElipse();
44 }
45 
46 static struct displayfuncs psfuncs[] = {
47   PSDrawFillCircle
48 };
49 
_GPSDraw_CreateDisplay()50 void _GPSDraw_CreateDisplay()
51 {
52   struct gpsdisplay *gdisp;
53   gdisp->funcs = (void *)&psfuncs;
54 }
55