cgen: materialise str-def operands in streq pushes
A str `def` has no name(SB) header; the streq push arms read a frame slot that does not exist. Load the literal through cgexpr (AX=ptr, BX=len) instead. Both stages.
This commit is contained in:
@@ -5808,6 +5808,14 @@ fn cgstreqpush(c: *cgen, op: *syntax.node) void = {
|
||||
emitline("\tPUSHQ\tAX\n");
|
||||
return;
|
||||
};
|
||||
if (lc == nil && deflookup(c, nm)) {
|
||||
// A str def has no name(SB) header. Its ordinary expression
|
||||
// load materialises the literal as AX=ptr, BX=len.
|
||||
cgexpr(c, op);
|
||||
emitline("\tPUSHQ\tBX\n");
|
||||
emitline("\tPUSHQ\tAX\n");
|
||||
return;
|
||||
};
|
||||
let off: i32 = 0;
|
||||
if (lc != nil) { off = lc.off; };
|
||||
emitline("\tMOVQ\t");
|
||||
|
||||
Reference in New Issue
Block a user