summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug1856409.c
blob: 0ff2dd54c46565db78c2edef0583d2e35e9eb5f2 (plain) (blame)
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
/*
    bug 1856409
    storage: static __code,
*/

#include <stdint.h>
#include <testfwk.h>

#ifndef PORT_HOST
#pragma disable_warning 158 //no warning about overflow in constant (W_LIT_OVERFLOW)
#endif

typedef struct {
  unsigned int e:2;
  unsigned int f:3;
  unsigned int g:3;
} Ta;

void
testBug (void)
{
  {storage} Ta aa = {1, 29, 0};
  {storage} uint16_t xx = 100000;
  char t;

  t = aa.e;
  ASSERT (t == (1 & 3));
  t = aa.f;
  ASSERT (t == (29 & 7));
  t = aa.g;
  ASSERT (t ==  (0 & 7));

  ASSERT (xx == (uint16_t)(100000 & 65535));
}