summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler.c b/compiler.c
index c31e9ae..682084e 100644
--- a/compiler.c
+++ b/compiler.c
@@ -807,7 +807,11 @@ void var_op_dereference(CompData *out, Variable *store, Variable *from) {
if (from->location < 1 || from->ptr_chain.count > 1) {
// Generate initial move (from -> rsi)
- vect_push_string(&out->text, "\tmov rsi, ");
+ if (_var_ptr_type(from) > 0)
+ vect_push_string(&out->text, "\tlea rsi, ");
+ else
+ vect_push_string(&out->text, "\tmov rsi, ");
+
if (from->location == LOC_DATA || from->location == LOC_STCK)
vect_push_string(&out->text, PREFIXES[7]);