Skip to content

Commit

Permalink
make self-hosted the default compiler
Browse files Browse the repository at this point in the history
stage1 is available behind the -fstage1 flag.

closes ziglang#89
  • Loading branch information
andrewrk committed Aug 19, 2022
1 parent e6e1ce6 commit 3beb927
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion safety/empty slice with sentinel out of bounds.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");

pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to index out of bound: index 1, len 0")) {
if (std.mem.eql(u8, message, "index out of bounds: index 1, len 0")) {
std.process.exit(0);
}
std.process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions safety/out of bounds slice access.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ const std = @import("std");

pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to index out of bound: index 4, len 4")) {
if (std.mem.eql(u8, message, "index out of bounds: index 4, len 4")) {
std.process.exit(0);
}
std.process.exit(1);
}
pub fn main() !void {
const a = [_]i32{1, 2, 3, 4};
const a = [_]i32{ 1, 2, 3, 4 };
baz(bar(&a));
return error.TestFailed;
}
fn bar(a: []const i32) i32 {
return a[4];
}
fn baz(_: i32) void { }
fn baz(_: i32) void {}
// run
// backend=llvm
// target=native
2 changes: 1 addition & 1 deletion safety/slice with sentinel out of bounds - runtime len.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");

pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to index out of bound: index 5, len 4")) {
if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
std.process.exit(0);
}
std.process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion safety/slice with sentinel out of bounds.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");

pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to index out of bound: index 5, len 4")) {
if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
std.process.exit(0);
}
std.process.exit(1);
Expand Down

0 comments on commit 3beb927

Please sign in to comment.