Debian Codegraph @

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

raw
1 /* Test failed on an architecture that:
2
3 - had 16-bit registers,
4 - passed 64-bit structures in registers,
5 - only allowed SImode values in even numbered registers.
6
7 Before reload, s.i2 in foo() was represented as:
8
9 (subreg:SI (reg:DI 0) 2)
10
11 find_dummy_reload would return (reg:SI 1) for the subreg reload,
12 despite that not being a valid register. */
13
14 void abort (void);
15 void exit (int);
16
17 struct s
18 {
19 short i1;
20 long i2;
21 short i3;
22 };
23
24 struct s foo (struct s s)
25 {
26 s.i2++;
27 return s;
28 }
29
30 int main ()
31 {
32 struct s s = foo ((struct s) { 1000, 2000L, 3000 });
33 if (s.i1 != 1000 || s.i2 != 2001L || s.i3 != 3000)
34 abort ();
35 exit (0);
36 }