changeset 94:83ba34ed11b3

Fixed problem with constant expressions evaluating to 0 when they shouldn't
author lost
date Sat, 17 Jan 2009 06:50:49 +0000
parents 34ca1c6e9550
children f3497072ac44
files src/lwasm.c src/pseudo.c
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lwasm.c	Sat Jan 17 06:27:01 2009 +0000
+++ b/src/lwasm.c	Sat Jan 17 06:50:49 2009 +0000
@@ -412,7 +412,7 @@
 		*inp = (char *)ep;
 		if (slot >= 0)
 		{
-			l -> exprends[slot] = ep;
+			l -> exprends[slot] = (char *)ep;
 			l -> exprvals[slot] = lwasm_expr_get_value(s);
 		}
 	}
@@ -427,9 +427,11 @@
 
 	if (s && lwasm_expr_is_constant(s))
 	{
+		*val = lwasm_expr_get_value(s);
 		lwasm_expr_stack_free(s);
 		l -> exprs[slot] = NULL;
 		s = NULL;
+		return 0;
 	}
 
 	if (!s && slot >= 0)
--- a/src/pseudo.c	Sat Jan 17 06:27:01 2009 +0000
+++ b/src/pseudo.c	Sat Jan 17 06:50:49 2009 +0000
@@ -130,8 +130,7 @@
 		as -> addr += l -> nocodelen;
 		return;
 	}
-	
-	r = lwasm_expr_result2(as, l, p, EXPR_PASS1CONST, &v, 0);
+	r = lwasm_expr_result2(as, l, p, EXPR_PASS1CONST, &v, -1);
 	if (r != 0)
 		return;
 	l -> nocodelen = v;