AVR: Fix some test options. Skip tests with address-space on Reduced Tiny.
[official-gcc.git] / gcc / testsuite / gcc.target / avr / pr46779-2.c
blob557cc749c758a2aaeb82c775218741a8ae531e0e
1 /* { dg-do run { target { ! avr_tiny } } } */
2 /* { dg-options "-Os -fno-split-wide-types" } */
4 /* This testcase should uncover bugs like
5 PR46779
6 PR45291
7 PR41894
9 The inline asm just serves to direct y into the Y register.
10 Otherwise, it is hard to write a "stable" test case that
11 also fails with slight variations in source code, middle- resp.
12 backend.
14 The problem is that Y is also the frame-pointer, and
15 avr.c:avr_hard_regno_mode_ok disallows QI to get in Y-reg.
16 However, the y.a = 0 generates a
17 (set (subreg:QI (reg:HI pseudo)) ...)
18 where pseudo gets allocated to Y.
20 Reload fails to generate the right spill.
23 #include <stdlib.h>
25 struct S
27 unsigned char a, b;
28 } ab = {12, 34};
30 void yoo (struct S y)
32 __asm volatile ("ldi %B0, 56" : "+y" (y));
33 y.a = 0;
34 __asm volatile ("; y = %0" : "+y" (y));
35 ab = y;
38 int main ()
40 yoo (ab);
42 if (ab.a != 0)
43 abort();
45 if (ab.b != 56)
46 abort();
48 exit (0);
50 return 0;