1 /* Test support of scalar_storage_order attribute */
2
3 /* { dg-do compile } */
4
5 struct __attribute__((scalar_storage_order("big-endian"))) S1
6 {
7 int i;
8 };
9
10 struct __attribute__((scalar_storage_order("little-endian"))) S2
11 {
12 int i;
13 };
14
15 extern int foo (void *);
16
17 int incompatible_call (int which, struct S1 *s1, struct S2 *s2)
18 {
19 if (which == 1) return foo (s1); else foo (s2); /* { dg-warning "incompatible scalar storage order" } */
20 }
21
22 void incompatible_assign (struct S1 *s1, struct S2 *s2)
23 {
24 void *p1, *p2;
25 p1 = s1, p2 = s2; /* { dg-warning "incompatible scalar storage order" } */
26 }
27
28 void incompatible_init (struct S1 *s1, struct S2 *s2)
29 {
30 void *p1 = s1, *p2 = s2; /* { dg-warning "incompatible scalar storage order" } */
31 }
32
33 void *incompatible_return (int which, struct S1 *s1, struct S2 *s2)
34 {
35 if (which == 1) return s1; else return s2; /* { dg-warning "incompatible scalar storage order" } */
36 }