summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3085.c
blob: 05737462091f5bb9742d81c6990a211b280ee19f (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
/* bug-3085.c
   Pdk code generation for wide < overwrote upper byte of operand in p.
 */
 
#include <testfwk.h>

#include <stdint.h>

uint16_t f(void)
{
  uint16_t cc = 0;
  for (uint16_t j = 0; j < 500; j++) { // Code generation for upper byte for < overwrote upper byte of j.
    cc++;
  }

  cc = ~cc;

  return cc;
}

void
testBug(void)
{
  ASSERT (f() == (uint16_t)(~(uint16_t)500));
}