Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020529-1.c
blobd34fec160fab7c50a9eb2969f9023021094314c7
1 /* PR target/6838 from cato@df.lth.se.
2 cris-elf got an ICE with -O2: the insn matching
3 (insn 49 48 52 (parallel[
4 (set (mem/s:HI (plus:SI (reg/v/f:SI 0 r0 [24])
5 (const_int 8 [0x8])) [5 <variable>.c+0 S2 A8])
6 (reg:HI 2 r2 [27]))
7 (set (reg/f:SI 2 r2 [31])
8 (plus:SI (reg/v/f:SI 0 r0 [24])
9 (const_int 8 [0x8])))
10 ] ) 24 {*mov_sidehi_mem} (nil)
11 (nil))
12 forced a splitter through the output pattern "#", but there was no
13 matching splitter. */
15 /* The ptx assembler appears to clobber 'b' inside foo during the f1 call.
16 Reported to nvidia 2016-05-18. */
17 /* { dg-skip-if "PTX assembler bug" { nvptx-*-* } { "-O0" } { "" } } */
19 void abort (void);
20 void exit (int);
22 struct xx
24 int a;
25 struct xx *b;
26 short c;
29 int f1 (struct xx *);
30 void f2 (void);
32 int
33 foo (struct xx *p, int b, int c, int d)
35 int a;
37 for (;;)
39 a = f1(p);
40 if (a)
41 return (0);
42 if (b)
43 continue;
44 p->c = d;
45 if (p->a)
46 f2 ();
47 if (c)
48 f2 ();
49 d = p->c;
50 switch (a)
52 case 1:
53 if (p->b)
54 f2 ();
55 if (c)
56 f2 ();
57 default:
58 break;
61 return d;
64 int main (void)
66 struct xx s = {0, &s, 23};
67 if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0)
68 abort ();
69 exit (0);
72 int
73 f1 (struct xx *p)
75 static int beenhere = 0;
76 if (beenhere++ > 1)
77 abort ();
78 return beenhere > 1;
81 void
82 f2 (void)
84 abort ();