| ... | ... | @@ -16614,6 +16614,7 @@ fn zirAsm( |
| 16614 | 16614 | const clobbers_len: u5 = @truncate(extended.small >> 10); |
| 16615 | 16615 | const is_volatile = @as(u1, @truncate(extended.small >> 15)) != 0; |
| 16616 | 16616 | const is_global_assembly = sema.func_index == .none; |
| 16617 | const zir_tags = sema.code.instructions.items(.tag); |
| 16617 | 16618 | |
| 16618 | 16619 | const asm_source: []const u8 = if (tmpl_is_expr) blk: { |
| 16619 | 16620 | const tmpl: Zir.Inst.Ref = @enumFromInt(@intFromEnum(extra.data.asm_source)); |
| ... | ... | @@ -16674,6 +16675,13 @@ fn zirAsm( |
| 16674 | 16675 | const name = sema.code.nullTerminatedString(output.data.name); |
| 16675 | 16676 | needed_capacity += (constraint.len + name.len + (2 + 3)) / 4; |
| 16676 | 16677 | |
| 16678 | if (output.data.operand.toIndex()) |index| { |
| 16679 | if (zir_tags[@intFromEnum(index)] == .ref) { |
| 16680 | // TODO: better error location; it would be even nicer if there were notes that pointed at the output and the variable definition |
| 16681 | return sema.fail(block, src, "asm cannot output to const local '{s}'", .{name}); |
| 16682 | } |
| 16683 | } |
| 16684 | |
| 16677 | 16685 | outputs[out_i] = .{ .c = constraint, .n = name }; |
| 16678 | 16686 | } |
| 16679 | 16687 | |