summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug3027957.c
blob: 9a08b12807d17290fd9cd58c362ed287d18eeff0 (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
/*
   bug3027957.c
 */

#include <testfwk.h>

#ifdef __SDCC_stm8
#define ADDRESS 0x1000
#else
#define ADDRESS 0xF000
#endif

void foo(void)
{
  ((unsigned char __xdata *)ADDRESS)[100] = 0x12;
}

/* bug 3034400: this  should not give a warning/error */
char * correct(void)
{
  return (char __code *) 0x1234;
}

void testBug(void)
{
#if !defined (__SDCC_pdk14) && !defined (__SDCC_pdk15) // I have no idea yet, how integers cast to pointers should behave here on pdk14
#ifdef __SDCC
  foo();
  ASSERT (*(unsigned char __xdata *)(ADDRESS + 0x64) == 0x12);
#endif
#endif
}