blob: f4203ec1b9750a2464eaa84117f881cf7d6d23ef (
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
|
/* { dg-do run } */
/* { dg-options "-std=c23" } */
int
foo (int x)
{
if (x != 3)
__builtin_abort ();
return 1;
}
int
main ()
{
unsigned char a[] = {
[5] = foo (0),
[7] = foo (1),
[42] = foo (2),
#embed __FILE__ prefix([0] = ) suffix (,) /* { dg-warning "initialized field with side-effects overwritten" } */
[12] = foo (3) /* { dg-message "near initialization" "" { target *-*-* } .-1 } */
};
const unsigned char b[] = {
#embed __FILE__
};
if (sizeof (a) != sizeof (b)
|| __builtin_memcmp (a, b, 12)
|| a[12] != 1
|| __builtin_memcmp (a + 13, b + 13, sizeof (a) - 13))
__builtin_abort ();
}
|