summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug2655200.c
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/bug2655200.c
downloadsdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/bug2655200.c')
-rw-r--r--support/regression/tests/bug2655200.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/support/regression/tests/bug2655200.c b/support/regression/tests/bug2655200.c
new file mode 100644
index 0000000..a61d5eb
--- /dev/null
+++ b/support/regression/tests/bug2655200.c
@@ -0,0 +1,61 @@
+/*
+ * [ 2655200 ] pointer to pdata memory not correctly initialized
+ *
+ * test_array[..] = &thing_pdata
+ * was incorrect
+ *
+ * SDCCclue.c(initPointer)
+ * ... SPEC_SCLS (expr->left->etype) == S_PDATA)
+ * was not handeled
+ */
+
+#include <testfwk.h>
+#include <stdint.h>
+
+char thing;
+#if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
+__code char thing_code = 0;
+__data char thing_data;
+__idata char thing_idata;
+__xdata char thing_xdata;
+__pdata char thing_pdata;
+__pdata char thing_apdata[2];
+#endif
+
+
+const char * __code test_array[] = {
+ &thing
+#if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
+ , &thing_code
+ , &thing_data, &thing_idata, &thing_xdata, &thing_pdata
+ , thing_apdata, (char *)thing_apdata
+#endif
+};
+
+
+const char *gime_thing() { return &thing; }
+#if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
+const char *gime_thing_code() { return &thing_code; }
+const char *gime_thing_data() { return &thing_data; }
+const char *gime_thing_idata() { return &thing_idata; }
+const char *gime_thing_xdata() { return &thing_xdata; }
+const char *gime_thing_pdata() { return &thing_pdata; }
+const char *gime_thing_apdata() { return thing_apdata; }
+#endif
+
+
+void
+testBug(void)
+{
+ ASSERT(test_array[0] == gime_thing());
+
+#if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
+ ASSERT(test_array[1] == gime_thing_code());
+ ASSERT(test_array[2] == gime_thing_data());
+ ASSERT(test_array[3] == gime_thing_idata());
+ ASSERT(test_array[4] == gime_thing_xdata());
+ ASSERT(test_array[5] == gime_thing_pdata());
+ ASSERT(test_array[6] == gime_thing_apdata());
+ ASSERT(test_array[7] == gime_thing_apdata());
+#endif
+}