aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/bitfield9.C
blob: 2e309c34167f06793d05561ed70cd17d56110d06 (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
// PR c++/32346
// { dg-do run }
// { dg-options "-Wno-overflow" }

extern "C" void abort();

typedef int int32_t __attribute__((mode (__SI__)));

struct S {
  long long i : 32;
};

void f(int32_t i, int32_t j) {
  if (i != 0xabcdef01)
    abort();
  if (j != 0)
    abort();
}

void g(S s) {
  f(s.i, 0);
}

int main() {
  S s;
  s.i = 0xabcdef01;
  g(s);
}