diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-02-19 22:29:40 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-02-19 22:29:40 -0500 |
commit | bd67baa5e2b9281ffc2b57be5fbd6d9514799994 (patch) | |
tree | 2190a6efde56290e967104cbcd92994bbfbcd01c | |
parent | b95702eaa97b578f623610e3f8695a5174233e30 (diff) |
Fix for array deref
-rw-r--r-- | compiler.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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]); |