aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sso-11.c
blob: 6b50a25485813f679efd59e4a90b9dbcb2953a0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Test support of scalar_storage_order attribute */

/* { dg-do compile } */

struct __attribute__((scalar_storage_order("big-endian"))) S1
{
  int i;
};

struct __attribute__((scalar_storage_order("little-endian"))) S2
{
  int i;
};

extern int foo (void *);

int incompatible_call (int which, struct S1 *s1, struct S2 *s2)
{
  if (which == 1) return foo (s1); else foo (s2); /* { dg-warning "incompatible scalar storage order" } */
}

void incompatible_assign (struct S1 *s1, struct S2 *s2)
{
  void *p1, *p2;
  p1 = s1, p2 = s2; /* { dg-warning "incompatible scalar storage order" } */
}

void incompatible_init (struct S1 *s1, struct S2 *s2)
{
  void *p1 = s1, *p2 = s2; /* { dg-warning "incompatible scalar storage order" } */
}

void *incompatible_return (int which, struct S1 *s1, struct S2 *s2)
{
  if (which == 1) return s1; else return s2; /* { dg-warning "incompatible scalar storage order" } */
}