1/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2/* { dg-options "-O2 -mminimal-toc" } */
3
4/* PR 39457 -- fix breakage because the compiler ran out of registers and
5   wanted to stash a floating point value to the LR/CTR register.  */
6
7/* -O2 -m64 -mminimal-toc */
8typedef struct { void *s; } S;
9typedef void (*T1) (void);
10typedef void (*T2) (void *, void *, int, void *);
11char *fn1 (const char *, ...);
12void *fn2 (void);
13int fn3 (char *, int);
14int fn4 (const void *);
15int fn5 (const void *);
16long fn6 (void) __attribute__ ((__const__));
17int fn7 (void *, void *, void *);
18void *fn8 (void *, long);
19void *fn9 (void *, long, const char *, ...);
20void *fn10 (void *);
21long fn11 (void) __attribute__ ((__const__));
22long fn12 (void *, const char *, T1, T2, void *);
23void *fn13 (void *);
24long fn14 (void) __attribute__ ((__const__));
25extern void *v1;
26extern char *v2;
27extern int v3;
28
29void
30foo (void *x, char *z)
31{
32  void *i1, *i2;
33  int y;
34  if (v1)
35    return;
36  v1 = fn9 (fn10 (fn2 ()), fn6 (), "x", 0., "y", 0., 0);
37  y = 520 - (520 - fn4 (x)) / 2;
38  fn9 (fn8 (v1, fn6 ()), fn6 (), "wig", fn8 (v1, fn14 ()), "x", 18.0,
39       "y", 16.0, "wid", 80.0, "hi", 500.0, 0);
40  fn9 (fn10 (v1), fn6 (), "x1", 0., "y1", 0., "x2", 80.0, "y2",
41       500.0, "f", fn3 ("fff", 0x0D0DFA00), 0);
42  fn13 (((S *) fn8 (v1, fn6 ()))->s);
43  fn12 (fn8 (v1, fn11 ()), "ev", (T1) fn7, 0, fn8 (v1, fn6 ()));
44  fn9 (fn8 (v1, fn6 ()), fn6 (), "wig",
45       fn8 (v1, fn14 ()), "x", 111.0, "y", 14.0, "wid", 774.0, "hi",
46       500.0, 0);
47  v1 = fn9 (fn10 (v1), fn6 (), "x1", 0., "y1", 0., "x2", 774.0, "y2",
48            500.0, "f", fn3 ("gc", 0x0D0DFA00), 0);
49  fn1 (z, 0);
50  i1 = fn9 (fn8 (v1, fn6 ()), fn6 (), "pixbuf", x, "x",
51            800 - fn5 (x) / 2, "y", y - fn4 (x), 0);
52  fn12 (fn8 (i1, fn11 ()), "ev", (T1) fn7, 0, "/ok/");
53  fn12 (fn8 (i1, fn11 ()), "ev", (T1) fn7, 0, 0);
54  i2 = fn9 (fn8 (v1, fn6 ()), fn6 (), "txt", "OK", "fnt", v2, "x",
55            800, "y", y - fn4 (x) + 15, "ar", 0, "f", v3, 0);
56}
57