summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr28243.c
blob: 12447a1c3d31022295cd062c50ba651c63db24ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* PR rtl-optimization/28243 */
/* Reported by Mike Frysinger <vapier@gentoo.org> */

/* { dg-do compile } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -ftracer -fPIC" } */
/* { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } */

struct displayfuncs {
  void (*init) ();
} funcs;

struct gpsdisplay {
  struct displayfuncs *funcs;
};

static void PSMyArc(double cx, double cy, double radx, double rady, double sa,
		    double ta)
{
  double ea;
  double temp;
  ea = sa + ta;
  while (sa < ea) {
    temp = ((sa + 90) / 90) * 90;
    PSDoArc(cx, sa, ea < temp ? ea : temp);
    sa = temp;
  }
}

static void PSDrawElipse()
{
  float cx;
  float cy;
  float radx;
  float rady;
  if (radx != rady)
    PSMyArc(cx, cy, radx, rady, 0, 360);
}

static void PSDrawFillCircle()
{
  PSDrawElipse();
}

static struct displayfuncs psfuncs[] = {
  PSDrawFillCircle
};

void _GPSDraw_CreateDisplay()
{
  struct gpsdisplay *gdisp;
  gdisp->funcs = (void *)&psfuncs;
}