Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr58416.c

raw
1 /* { dg-do run } */
2
3 struct s {
4 char s[sizeof(long double)];
5 };
6
7 union u {
8 long double d;
9 struct s s;
10 };
11
12 int main()
13 {
14 union u x = {0};
15 #if __SIZEOF_LONG_DOUBLE__ == 16
16 x.s = (struct s){"xxxxxxxxxxxxxxxx"};
17 #elif __SIZEOF_LONG_DOUBLE__ == 12
18 x.s = (struct s){"xxxxxxxxxxxx"};
19 #elif __SIZEOF_LONG_DOUBLE__ == 8
20 x.s = (struct s){"xxxxxxxx"};
21 #elif __SIZEOF_LONG_DOUBLE__ == 4
22 x.s = (struct s){"xxxx"};
23 #endif
24
25 union u y = x;
26
27 for (unsigned char *p = (unsigned char *)&y + sizeof y;
28 p-- > (unsigned char *)&y;)
29 if (*p != (unsigned char)'x')
30 __builtin_abort ();
31 return 0;
32 }