commit fdf4c875ffbbeb24f844718d9eb92bac38e7147e (tree)
parent 3525b8778edd235d8d0ad2b55eee83eacd33d5cf
Author: Veikka Tuominen <git@vexu.eu>
Date: Fri, 23 Sep 2022 17:09:21 +0300
llvm: avoid crash on duplicate asm input/output name
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
@@ -5972,7 +5972,9 @@ pub const FuncGen = struct {
}
if (!std.mem.eql(u8, name, "_")) {
- name_map.putAssumeCapacityNoClobber(name, total_i);
+ const gop = name_map.getOrPutAssumeCapacity(name);
+ if (gop.found_existing) return self.todo("duplicate asm output name '{s}'", .{name});
+ gop.value_ptr.* = total_i;
}
total_i += 1;
}
@@ -6028,7 +6030,9 @@ pub const FuncGen = struct {
}
if (!std.mem.eql(u8, name, "_")) {
- name_map.putAssumeCapacityNoClobber(name, total_i);
+ const gop = name_map.getOrPutAssumeCapacity(name);
+ if (gop.found_existing) return self.todo("duplicate asm input name '{s}'", .{name});
+ gop.value_ptr.* = total_i;
}
// In the case of indirect inputs, LLVM requires the callsite to have