summaryrefslogtreecommitdiff
path: root/test/Sema/address-packed-member-memops.c
blob: 220132f332987f3667bc0235a67d795f8d1979df (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
// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics

struct B {
  int x, y, z, w;
} b;

struct __attribute__((packed)) A {
  struct B b;
} a;

typedef __typeof__(sizeof(int)) size_t;

void *memcpy(void *dest, const void *src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
void *memmove(void *dest, const void *src, size_t n);
void *memset(void *s, int c, size_t n);

int x;

void foo(void) {
  memcpy(&a.b, &b, sizeof(b));
  memmove(&a.b, &b, sizeof(b));
  memset(&a.b, 0, sizeof(b));
  x = memcmp(&a.b, &b, sizeof(b));
}