summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug1618050.c
blob: 6fc6ef2a7a56daa0b13ca0d7eb200c2e0aad0504 (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
/** bug 1618050
 *    global variable px in function buggy, is marked rematr..
 *    and is erronously assumed to retain its value "x" across
 *    the function call to fiddle_px
 */

#include <testfwk.h>

_STATMEM char * __data px;
_STATMEM char x[2] = {0,42};

void
fiddle_px (_STATMEM char * unused)
{
  (volatile char) unused[0]; // shut up
  px++;
}

char
buggy (void)
{
  px = x;
  fiddle_px (x);
  return *px;
}

void
testBug (void)
{
  ASSERT (buggy () == 42);
}