summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2750.c
blob: 65117693d3cb439d55c9cb80c50f0539891badcb (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
35
36
37
38
39
40
/*
   bug1-2195.c

   frontend used | in place of ^.
*/

#include <testfwk.h>

typedef struct
  {
  unsigned LATC0                : 1;
  unsigned LATC1                : 1;
  unsigned LATC2                : 1;
  unsigned LATC3                : 1;
  unsigned LATC4                : 1;
  unsigned LATC5                : 1;
  unsigned LATC6                : 1;
  unsigned LATC7                : 1;
  } LATCbits_t;

volatile LATCbits_t LATCbits;

unsigned short mask;

void set_bits(unsigned char sn)
{
    LATCbits.LATC0 = ((mask >> sn) & 1) ^ ~0x1;
}

volatile unsigned char bit;

void testBug(void)
{
    LATCbits.LATC0 = 1;
    mask = 0x00;
    bit = 0;
    set_bits(bit);
    ASSERT(!LATCbits.LATC0);
}