* src/z80/gen.c (commitPair): Fixed silly gbz80/z80 commit to static bug.
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1502
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2001-11-04 Michael Hope <michaelh@juju.net.nz>
+
+ * support/regression/tests/bug-478094.c: Added.
+
+ * src/z80/gen.c (commitPair): Fixed silly gbz80/z80 commit to static bug.
+
2001-11-04 Bernhard Held <bernhard@bernhardheld.de>
* sdcc/sim/ucsim/s51.src/uc390cl.h: Improvement for ds390 to run regression tests
2001-11-04 Bernhard Held <bernhard@bernhardheld.de>
* sdcc/sim/ucsim/s51.src/uc390cl.h: Improvement for ds390 to run regression tests
static void
commitPair (asmop * aop, PAIR_ID id)
{
static void
commitPair (asmop * aop, PAIR_ID id)
{
- if (id == PAIR_HL && requiresHL (aop))
+ /* PENDING: Verify this. */
+ if (id == PAIR_HL && requiresHL (aop) && IS_GB)
{
emit2 ("ld a,l");
emit2 ("ld d,h");
{
emit2 ("ld a,l");
emit2 ("ld d,h");
- aopPut (aop, _pairs[id].l, 0);
- aopPut (aop, _pairs[id].h, 1);
+ /* Special cases */
+ if (id == PAIR_HL && aop->type == AOP_IY && aop->size == 2)
+ {
+ char *l = aopGetLitWordLong (aop, 0, FALSE);
+ wassert (l);
+
+ emit2 ("ld (%s),%s", l, _pairs[id].name);
+ }
+ else
+ {
+ aopPut (aop, _pairs[id].l, 0);
+ aopPut (aop, _pairs[id].h, 1);
+ }
--- /dev/null
+/* Tests a commit problem.
+ */
+#include <testfwk.h>
+
+
+
+int foo = 16;
+
+extern void f( int x );
+
+void g(int bar)
+{
+ int a = 0;
+ int b = 0;
+
+ while(1) {
+ switch(bar) {
+ case 0:
+ --foo;
+ f(foo);
+ break;
+ case 1:
+ ++foo;
+ f(foo);
+ break;
+ case 2:
+ ++a;
+ f(a);
+ break;
+ case 3:
+ ++b;
+ f(b);
+ break;
+ }
+ }
+}