OSDN Git Service

PR middle-end/40692
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / pr39240.c
1 /* PR target/39240 */
2
3 extern void abort (void);
4
5 __attribute__ ((noinline))
6 static int foo1 (int x)
7 {
8   return x;
9 }
10
11 __attribute__ ((noinline))
12 unsigned int bar1 (int x)
13 {
14   return foo1 (x + 6);
15 }
16
17 volatile unsigned long l1 = (unsigned int) -4;
18
19 __attribute__ ((noinline))
20 static short int foo2 (int x)
21 {
22   return x;
23 }
24
25 __attribute__ ((noinline))
26 unsigned short int bar2 (int x)
27 {
28   return foo2 (x + 6);
29 }
30
31 volatile unsigned long l2 = (unsigned short int) -4;
32
33 __attribute__ ((noinline))
34 static signed char foo3 (int x)
35 {
36   return x;
37 }
38
39 __attribute__ ((noinline))
40 unsigned char bar3 (int x)
41 {
42   return foo3 (x + 6);
43 }
44
45 volatile unsigned long l3 = (unsigned char) -4;
46
47 __attribute__ ((noinline))
48 static unsigned int foo4 (int x)
49 {
50   return x;
51 }
52
53 __attribute__ ((noinline))
54 int bar4 (int x)
55 {
56   return foo4 (x + 6);
57 }
58
59 volatile unsigned long l4 = (int) -4;
60
61 __attribute__ ((noinline))
62 static unsigned short int foo5 (int x)
63 {
64   return x;
65 }
66
67 __attribute__ ((noinline))
68 short int bar5 (int x)
69 {
70   return foo5 (x + 6);
71 }
72
73 volatile unsigned long l5 = (short int) -4;
74
75 __attribute__ ((noinline))
76 static unsigned char foo6 (int x)
77 {
78   return x;
79 }
80
81 __attribute__ ((noinline))
82 signed char bar6 (int x)
83 {
84   return foo6 (x + 6);
85 }
86
87 volatile unsigned long l6 = (signed char) -4;
88
89 int
90 main (void)
91 {
92   if (bar1 (-10) != l1)
93     abort ();
94   if (bar2 (-10) != l2)
95     abort ();
96   if (bar3 (-10) != l3)
97     abort ();
98   if (bar4 (-10) != l4)
99     abort ();
100   if (bar5 (-10) != l5)
101     abort ();
102   if (bar6 (-10) != l6)
103     abort ();
104   return 0;
105 }