aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cpp/embed-23.c
blob: ea00c6ca4bf5364ca638f33d84da65ba3dc3ede4 (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
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-std=gnu23" { target c } } */

typedef unsigned char V __attribute__((vector_size (16)));

struct S { _Complex double a; V b; int c; };
struct T { int a; struct S b; int c; struct S d; int e; unsigned char f[22]; _Complex long double g; };

const unsigned char a[] = {
  #embed __FILE__ limit (124)
};
const struct T b[2] = {
  #embed __FILE__ limit (124)
};

int
main ()
{
  for (int i = 0; i < 2; ++i)
    if (b[i].a != a[i * 62]
	|| __real__ b[i].b.a != a[i * 62 + 1]
	|| __imag__ b[i].b.a
	|| __builtin_memcmp (&b[i].b.b, &a[i * 62 + 2], 16)
	|| b[i].b.c != a[i * 62 + 18]
	|| b[i].c != a[i * 62 + 19]
	|| __real__ b[i].d.a != a[i * 62 + 20]
	|| __imag__ b[i].d.a
	|| __builtin_memcmp (&b[i].d.b, &a[i * 62 + 21], 16)
	|| b[i].d.c != a[i * 62 + 37]
	|| b[i].e != a[i * 62 + 38]
	|| __builtin_memcmp (&b[i].f[0], &a[i * 62 + 39], 22)
	|| __real__ b[i].g != a[i * 62 + 61]
	|| __imag__ b[i].g)
      __builtin_abort ();
}