+2008-03-07 Raphael Neider <rneider AT web.de>
+
+ * src/regression/init0.c: new test for initialized arrays of function
+ pointers
+ * src/regression/Makefile: made a bit more flexible, added init0.c
+ * src/pic/glue.c (emitIvals): hacky fix for initializing from function
+ pointers, closes #1427663
+
2008-03-05 Borut Razem <borut.razem AT siol.net>
* dos/sdccman.lyx: docummented predefined macros SDCC_REVISION,
* src/SDCCutil.c,
* src/SDCCutil.h: added getBuildDate()
* src/SDCCmain.c (printVersionInfo),
- * src/SDCCglue.c (initialComments): use getBuildDate() instead of __DATE__
+ * src/SDCCglue.c (initialComments): use getBuildDate() instead of
+ __DATE__
* src/*/ralloc.c: removed IS_OP_RUONLY macro
* src/ds390/ralloc.c (packRegisters),
* src/mcs51/ralloc.c (packRegisters),
2008-02-27 Maarten Brock <sourceforge.brock AT dse.nl>
- * src/mcs51/gen.c (genUnpackBits): don't generate ifxJump, instead return
- ifx condition
+ * src/mcs51/gen.c (genUnpackBits): don't generate ifxJump, instead
+ return ifx condition
(genNearPointerGet, genPagedPointerGet, genFarPointerGet,
genCodePointerGet, genGenPointerGet): cleanup aop before generating
ifxJump to fix bug 1838000
}
for (i=0; i < size; i++) {
- char *text = op ? aopGet(AOP(op), i, 0, 0)
+ char *text;
+
+ /*
+ * FIXME: This is hacky and needs some more thought.
+ */
+ if (op && IS_SYMOP(op) && IS_FUNC(OP_SYM_TYPE(op))) {
+ /* This branch is introduced to fix #1427663. */
+ PCOI(AOP(op)->aopu.pcop)->offset+=i;
+ text = get_op(AOP(op)->aopu.pcop, NULL, 0);
+ PCOI(AOP(op)->aopu.pcop)->offset-=i;
+ } else {
+ text = op ? aopGet(AOP(op), i, 0, 0)
: get_op(newpCodeOpImmd(str, i, 0, inCodeSpace, 0), NULL, 0);
+ } // if
if (in_code) {
dbuf_printf (oBuf, "\tretlw %s\n", text);
} else {
#Q ?= # be verbose
Q ?= @ # be quiet
-CC = sdcc
+SDCC_SRC=../..
+SDCC_BIN=../..
+
+CC = $(SDCC_BIN)/bin/sdcc
LINKER = gplink
-USE_PIC16 ?= 1
+USE_PIC16 ?= 0
ifeq ($(strip $(filter 1 yes,$(USE_PIC16))),)
TARGETPIC = 16f877
-TARGETPIC = 16f84
+#TARGETPIC = 16f84
CFLAGS = -mpic14 -p$(TARGETPIC)
DIR = pic
else
endif
CFLAGS += -Wl,-q
CFLAGS += -Wl,--map
-CFLAGS += -I ../../device/include/$(DIR)
-CFLAGS += -L ../../device/lib/$(DIR)/bin
+CFLAGS += -I $(SDCC_SRC)/device/include/$(DIR)
+CFLAGS += -L $(SDCC_BIN)/device/lib/$(DIR)/bin
#CFLAGS += --no-pcode-opt
#CFLAGS += -V
configword.c \
empty.c \
for.c \
+ init0.c \
inline.c \
mult1.c \
nestfor.c \
--- /dev/null
+#include "gpsim_assert.h"
+
+unsigned failures = 0;
+
+void
+done(void)
+{
+ ASSERT(MANGLE(failures) == 0);
+ PASSED();
+}
+
+typedef void (void_void_f)(void);
+
+void
+foo(void) {
+ failures--;
+}
+
+void
+bar(void) {
+ failures -= 2;
+}
+
+static void_void_f *
+funcs[] = {
+ &foo,
+ &bar,
+ (void *)0
+};
+
+void
+main(void)
+{
+ void_void_f **ptr;
+ failures = 3;
+
+ ptr = &funcs[0];
+ while (*ptr) {
+ (**ptr)();
+ ptr++;
+ } // while
+
+ done();
+}
+