aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-09-25 20:39:18 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-09-26 16:06:05 -0700
commitfcfbedc2f06ba5700092a2cb444261133944be01 (patch)
tree759749fc494189073c1087cba2d05251564d050c /lib/std/builtin.zig
parent231783f2078bca02a8b861f2d750a61db0c4d581 (diff)
downloadzig-fcfbedc2f06ba5700092a2cb444261133944be01.tar.gz
zig-fcfbedc2f06ba5700092a2cb444261133944be01.zip
work around riscv64 backend deficiencies
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 4edcebad53..704d89dace 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -833,6 +833,10 @@ pub const PanicCause = union(enum) {
pub fn panicSentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn {
@branchHint(.cold);
+ if (builtin.zig_backend == .stage2_riscv64) {
+ // https://github.com/ziglang/zig/issues/21519
+ @trap();
+ }
switch (@typeInfo(@TypeOf(expected))) {
.int => |int| switch (int.signedness) {
.unsigned => if (int.bits <= @bitSizeOf(usize)) panic(.{ .sentinel_mismatch_usize = .{
@@ -864,11 +868,19 @@ pub fn panicSentinelMismatch(expected: anytype, found: @TypeOf(expected)) noretu
pub fn panicUnwrapError(ert: ?*StackTrace, err: anyerror) noreturn {
@branchHint(.cold);
+ if (builtin.zig_backend == .stage2_riscv64) {
+ // https://github.com/ziglang/zig/issues/21519
+ @trap();
+ }
panic(.{ .unwrap_error = err }, ert, @returnAddress());
}
pub fn panicOutOfBounds(index: usize, len: usize) noreturn {
@branchHint(.cold);
+ if (builtin.zig_backend == .stage2_riscv64) {
+ // https://github.com/ziglang/zig/issues/21519
+ @trap();
+ }
panic(.{ .index_out_of_bounds = .{
.index = index,
.len = len,
@@ -877,6 +889,10 @@ pub fn panicOutOfBounds(index: usize, len: usize) noreturn {
pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn {
@branchHint(.cold);
+ if (builtin.zig_backend == .stage2_riscv64) {
+ // https://github.com/ziglang/zig/issues/21519
+ @trap();
+ }
panic(.{ .start_index_greater_than_end = .{
.start = start,
.end = end,
@@ -885,6 +901,10 @@ pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn {
pub fn panicInactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn {
@branchHint(.cold);
+ if (builtin.zig_backend == .stage2_riscv64) {
+ // https://github.com/ziglang/zig/issues/21519
+ @trap();
+ }
panic(.{ .inactive_union_field = .{
.active = @tagName(active),
.accessed = @tagName(accessed),