aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr71522.c
blob: 953c4c71100f72d7c302bc845eda69e37f93e715 (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
/* { dg-do run } */

#if __SIZEOF_LONG_DOUBLE__ == 16
#define STR "AAAAAAAAAAAAAAA"
#elif __SIZEOF_LONG_DOUBLE__ == 12
#define STR "AAAAAAAAAAA"
#elif __SIZEOF_LONG_DOUBLE__ == 8
#define STR "AAAAAAA"
#elif __SIZEOF_LONG_DOUBLE__ == 4
#define STR "AAA"
#else
#define STR "A"
#endif

int main()
{
  long double d;
  char s[sizeof d];

  __builtin_memcpy(&d, STR, sizeof d);
  __builtin_memcpy(&s, &d, sizeof s);

  if (__builtin_strncmp (s, STR, sizeof s) != 0)
    __builtin_abort ();

  return 0;
}