summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2539.c
blob: b702cd0e6ca80f4b945abe0f2fc52f77290c04bc (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
/*
   bug-2539.c
*/

#include <testfwk.h>

#include <stdint.h>

struct sBITS {
  unsigned  b0 : 1;
  unsigned  b1 : 1;
  unsigned  b2 : 1;
  unsigned  b3 : 1;
  unsigned  b4 : 1;
  unsigned  b5 : 1;
  unsigned  b6 : 1;
  unsigned  b7 : 1;
};
struct sBITS vb;

void SetIf(uint8_t x)
{
  vb.b3 = (x != 0); // only bit 0 of 'x' testet
}   

void testBug(void)
{
  SetIf(0);

  ASSERT(!vb.b3);

  SetIf(24);

  ASSERT(vb.b3);
}