Skip to content

Commit c9dee0e

Browse files
committed
Fix logical NOT operator crash in Arm codegen
This replaces malformed TEQ instruction with proper CMP instruction for OP_log_not. TEQ requires two operands but was only given one, causing compilation failures for expressions using the \! operator. The fix uses CMP to compare the register with 0, followed by conditional MOV instructions to set the result correctly.
1 parent 695e616 commit c9dee0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/arm-codegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void emit_ph2_ir(ph2_ir_t *ph2_ir)
419419
emit(__eor_r(__AL, rd, rn, rm));
420420
return;
421421
case OP_log_not:
422-
emit(__teq(rn));
422+
emit(__cmp_i(__AL, rn, 0));
423423
emit(__mov_i(__NE, rd, 0));
424424
emit(__mov_i(__EQ, rd, 1));
425425
return;

0 commit comments

Comments
 (0)