From f5ed23867fc4a4f90440883f156862f408f56cb0 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Mon, 27 Apr 2015 23:20:16 +0200 Subject: [PATCH] Fix bad code generation multiple modifications of the same variable between sequence points leads to undefined behaviour. --- src/kn10def.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kn10def.h b/src/kn10def.h index 99b5d18..66e7770 100644 --- a/src/kn10def.h +++ b/src/kn10def.h @@ -235,7 +235,8 @@ typedef int pcinc_t; /* Type of all instruction routines */ #if KLH10_EXTADR # define PC_ADDXCT(x) { register pcinc_t i__ = (x); if (i__) PC_ADD(i__); } #else -# define PC_ADDXCT(x) (cpu.mr_PC += (x)) /* For now; fix up later? */ +# define PC_ADDXCT(x) { volatile pcinc_t i__ = (x); cpu.mr_PC += i__; } +/*# define PC_ADDXCT(x) (cpu.mr_PC += (x)) / * For now; fix up later? */ #endif /* Macros for putting PC into a word.