astgen: fix builtin_call ensure_result_used bit position
BuiltinCall.Flags has ensure_result_used at bit 1, not bit 3 like Call/FieldCall. Separate the case to use the correct bit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
astgen.c
16
astgen.c
@@ -6560,17 +6560,23 @@ static bool addEnsureResult(
|
||||
uint32_t inst = maybe_unused_result - ZIR_REF_START_INDEX;
|
||||
ZirInstTag tag = ag->inst_tags[inst];
|
||||
switch (tag) {
|
||||
// For call/field_call/builtin_call: set ensure_result_used flag
|
||||
// (bit 3 of flags at offset 0). Flags *must* be at offset 0 in all
|
||||
// three structs (AstGen.zig:2658-2665, Zir.zig:3022).
|
||||
// For call/field_call: set ensure_result_used flag
|
||||
// (bit 3 of flags at offset 0). Flags *must* be at offset 0
|
||||
// (AstGen.zig:2658-2665, Zir.zig:3022).
|
||||
case ZIR_INST_CALL:
|
||||
case ZIR_INST_FIELD_CALL:
|
||||
case ZIR_INST_BUILTIN_CALL: {
|
||||
case ZIR_INST_FIELD_CALL: {
|
||||
uint32_t pi = ag->inst_datas[inst].pl_node.payload_index;
|
||||
ag->extra[pi] |= (1u << 3); // ensure_result_used
|
||||
elide_check = true;
|
||||
break;
|
||||
}
|
||||
// For builtin_call: ensure_result_used is at bit 1, not bit 3.
|
||||
case ZIR_INST_BUILTIN_CALL: {
|
||||
uint32_t pi = ag->inst_datas[inst].pl_node.payload_index;
|
||||
ag->extra[pi] |= (1u << 1); // ensure_result_used
|
||||
elide_check = true;
|
||||
break;
|
||||
}
|
||||
// Always noreturn → elide (AstGen.zig:2909).
|
||||
case ZIR_INST_BREAK:
|
||||
case ZIR_INST_BREAK_INLINE:
|
||||
|
||||
Reference in New Issue
Block a user