Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/embed-12.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-std=c23" } */
3
4 int
5 foo (int x)
6 {
7 if (x != 3)
8 __builtin_abort ();
9 return 1;
10 }
11
12 int
13 main ()
14 {
15 unsigned char a[] = {
16 [5] = foo (0),
17 [7] = foo (1),
18 [42] = foo (2),
19 #embed __FILE__ prefix([0] = ) suffix (,) /* { dg-warning "initialized field with side-effects overwritten" } */
20 [12] = foo (3) /* { dg-message "near initialization" "" { target *-*-* } .-1 } */
21
22 };
23 const unsigned char b[] = {
24 #embed __FILE__
25 };
26 if (sizeof (a) != sizeof (b)
27 || __builtin_memcmp (a, b, 12)
28 || a[12] != 1
29 || __builtin_memcmp (a + 13, b + 13, sizeof (a) - 13))
30 __builtin_abort ();
31 }