* tests\bug-221100.c, tests\shifts.c, tests\absolute.c:
[fw/sdcc] / support / regression / tests / absolute.c
index cfc5b140c10a3e6a1915a0a169fe00872eb5e264..3f0598e48a92ae555d22f80113d57acd2733055d 100644 (file)
@@ -4,10 +4,22 @@
 */
 #include <testfwk.h>
 
-{mem} at(0xCAB7) char u;
-{mem} at(0xCAB7) char x = 'x';
-{mem} at(0xCAB9) char y = 'y';
-{mem} at(0xCAB0) int  k = 0x1234;
+#ifdef SDCC_pic16
+# define ADDRESS(x) (0x02 ## x)
+#else
+# define ADDRESS(x) (0xCA ## x)
+#endif
+
+typedef struct
+{
+        int a,b;
+} TestStruct;
+
+{mem} volatile at(ADDRESS(BC)) TestStruct TestVar = {0,0};
+{mem} at(ADDRESS(B7)) char u;
+{mem} at(ADDRESS(B7)) char x = 'x';
+{mem} at(ADDRESS(B9)) char y = 'y';
+{mem} at(ADDRESS(B0)) int  k = 0x1234;
 
 char z = 'z';
 
@@ -15,9 +27,9 @@ void
 testAbsolute(void)
 {
 #if defined(SDCC_mcs51) || defined(SDCC_ds390) || defined(SDCC_hc08)
-  static {mem} at(0xCAB6) char s = 's';
-  char {mem} *pC = (char {mem} *)(0xCAB0);
-  int  {mem} *pI = (int  {mem} *)(0xCAB0);
+  static {mem} at(ADDRESS(B6)) char s = 's';
+  char {mem} *pC = (char {mem} *)(ADDRESS(B0));
+  int  {mem} *pI = (int  {mem} *)(ADDRESS(B0));
 
   ASSERT(u == 'x');
   ASSERT(pC[7] == 'x');