From f488f7576c407e181de50be8df70f4f0ff7e3ab7 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Tue, 8 Oct 2013 23:03:53 +0200
Subject: [PATCH] Applied fix contributed by Greg King.
The code
void foo(void)
{
int i;
long l = 1L * i;
}
triggered an
Internal compiler error:
Code generation messed up: StackPtr is -4, should be -2
Greg King: "We are lucky that the bug is simple -- a missing "else". The result is that the compiler thinks that it does the opposite of what it actually does: It thinks that it pushes the non-constant expression onto the stack. It doesn't; so, cc65's stack pointer is wrong."
---
src/cc65/expr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cc65/expr.c b/src/cc65/expr.c
index 558967aa2..2125eb430 100644
--- a/src/cc65/expr.c
+++ b/src/cc65/expr.c
@@ -1952,6 +1952,7 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
type = CF_CONST;
if ((Gen->Flags & GEN_NOPUSH) == 0) {
g_push (ltype, 0);
+ } else {
ltype |= CF_REG; /* Value is in register */
}
--
2.39.5