summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3132.c
blob: cb9fe1948dfcbb65e4760e50da193c23bd69b79d (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
/*
   bug-3132.c
   A bug in pdk code generation for jump on & if all bytes of the mask are 0xff or 0x00 and the highest byte is 0x00.
 */

#include <testfwk.h>

#include <stdint.h>

volatile uint8_t block = 0;

void f(void)
{

  for( uint16_t t=0; t<0x101; t++ )
  {
    if( 0 == (t&0xFF) ) // BUG: this compare is compiled to "if( 0 == t )"
      block++;
  }
}

void
testBug (void)
{
  f();
  ASSERT (block == 2);
}