Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20020529-1.c

raw
1 /* PR target/6838 from [email protected].
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. */
14
15 void abort (void);
16 void exit (int);
17
18 struct xx
19 {
20 int a;
21 struct xx *b;
22 short c;
23 };
24
25 int f1 (struct xx *);
26 void f2 (void);
27
28 int
29 foo (struct xx *p, int b, int c, int d)
30 {
31 int a;
32
33 for (;;)
34 {
35 a = f1(p);
36 if (a)
37 return (0);
38 if (b)
39 continue;
40 p->c = d;
41 if (p->a)
42 f2 ();
43 if (c)
44 f2 ();
45 d = p->c;
46 switch (a)
47 {
48 case 1:
49 if (p->b)
50 f2 ();
51 if (c)
52 f2 ();
53 default:
54 break;
55 }
56 }
57 return d;
58 }
59
60 int main (void)
61 {
62 struct xx s = {0, &s, 23};
63 if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0)
64 abort ();
65 exit (0);
66 }
67
68 int
69 f1 (struct xx *p)
70 {
71 static int beenhere = 0;
72 if (beenhere++ > 1)
73 abort ();
74 return beenhere > 1;
75 }
76
77 void
78 f2 (void)
79 {
80 abort ();
81 }