aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/bitint-113.c
blob: 3c934a62fb47ed7f48f530cab5db5c794bc3b4e8 (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
32
33
34
35
36
37
38
39
40
/* PR middle-end/117354 */
/* { dg-do compile { target bitint } } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */

#if __BITINT_MAXWIDTH__ >= 256
#define N 256
#else
#define N 64
#endif

struct S {
  unsigned char y;
  _BitInt(N) x;
} s;

__attribute__((noipa)) static void
foo (const char *, _BitInt(N))
{
}

__attribute__((noipa)) static void
bar (_BitInt(N))
{
}

static void
baz (void *p)
{
  foo ("bazbazbazb", s.x);
  __builtin_memcpy (p, &s.x, sizeof s.x);
}

int
main ()
{
  void *ptr = &s.x;
  baz (&s.x);
  bar (*(_BitInt(N) *) ptr);
}