Debian Codegraph @

gcc/testsuite/c-c++-common/cpp/embed-20.c

raw
1 /* { dg-do run } */
2 /* { dg-options "" } */
3 /* { dg-additional-options "-std=c23" { target c } } */
4
5 unsigned char a[] = {
6 #embed __FILE__
7 };
8 struct S { unsigned char h[(sizeof (a) - 7) / 2]; short int i; unsigned char j[sizeof (a) - 7 - (sizeof (a) - 7) / 2]; };
9 struct T { int a, b, c; struct S d; long long e; double f; long long g; };
10 struct T b = {
11 #embed __FILE__
12 };
13
14 int
15 main ()
16 {
17 if (b.a != a[0] || b.b != a[1] || b.c != a[2]
18 || __builtin_memcmp (b.d.h, a + 3, sizeof (b.d.h))
19 || b.d.i != a[3 + sizeof (b.d.h)]
20 || __builtin_memcmp (b.d.j, a + 4 + sizeof (b.d.h), sizeof (b.d.j))
21 || b.e != a[sizeof (a) - 3] || b.f != a[sizeof (a) - 2]
22 || b.g != a[sizeof (a) - 1])
23 __builtin_abort ();
24 }