PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020529-1.c
blob160a716ba5bf574f4f20a6ea9ec84f4760bd6d29
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 struct xx
21 int a;
22 struct xx *b;
23 short c;
26 int f1 (struct xx *);
27 void f2 (void);
29 int
30 foo (struct xx *p, int b, int c, int d)
32 int a;
34 for (;;)
36 a = f1(p);
37 if (a)
38 return (0);
39 if (b)
40 continue;
41 p->c = d;
42 if (p->a)
43 f2 ();
44 if (c)
45 f2 ();
46 d = p->c;
47 switch (a)
49 case 1:
50 if (p->b)
51 f2 ();
52 if (c)
53 f2 ();
54 default:
55 break;
58 return d;
61 int main (void)
63 struct xx s = {0, &s, 23};
64 if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0)
65 abort ();
66 exit (0);
69 int
70 f1 (struct xx *p)
72 static int beenhere = 0;
73 if (beenhere++ > 1)
74 abort ();
75 return beenhere > 1;
78 void
79 f2 (void)
81 abort ();