aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig24
-rw-r--r--test/runtime_safety.zig2
-rw-r--r--test/stage1/behavior/async_fn.zig4
-rw-r--r--test/stage1/behavior/new_stack_call.zig2
4 files changed, 27 insertions, 5 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 5eec78fa7f..2088b32d98 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -3,6 +3,28 @@ const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "bad alignment in @asyncCall",
+ \\export fn entry() void {
+ \\ var ptr: async fn () void = func;
+ \\ var bytes: [64]u8 = undefined;
+ \\ _ = @asyncCall(&bytes, {}, ptr);
+ \\}
+ \\async fn func() void {}
+ ,
+ "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'",
+ );
+
+ cases.add(
+ "bad alignment in implicit cast from array pointer to slice",
+ \\export fn a() void {
+ \\ var x: [10]u8 = undefined;
+ \\ var y: []align(16) u8 = &x;
+ \\}
+ ,
+ "tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8'",
+ );
+
+ cases.add(
"result location incompatibility mismatching handle_is_ptr (generic call)",
\\export fn entry() void {
\\ var damn = Container{
@@ -164,7 +186,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"non async function pointer passed to @asyncCall",
\\export fn entry() void {
\\ var ptr = afunc;
- \\ var bytes: [100]u8 = undefined;
+ \\ var bytes: [100]u8 align(16) = undefined;
\\ _ = @asyncCall(&bytes, {}, ptr);
\\}
\\fn afunc() void { }
diff --git a/test/runtime_safety.zig b/test/runtime_safety.zig
index 0fb593c0e2..07a8c3910a 100644
--- a/test/runtime_safety.zig
+++ b/test/runtime_safety.zig
@@ -30,7 +30,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
\\ @import("std").os.exit(126);
\\}
\\pub fn main() void {
- \\ var bytes: [1]u8 = undefined;
+ \\ var bytes: [1]u8 align(16) = undefined;
\\ var ptr = other;
\\ var frame = @asyncCall(&bytes, {}, ptr);
\\}
diff --git a/test/stage1/behavior/async_fn.zig b/test/stage1/behavior/async_fn.zig
index e1b173292b..cb9bf2c1ea 100644
--- a/test/stage1/behavior/async_fn.zig
+++ b/test/stage1/behavior/async_fn.zig
@@ -280,7 +280,7 @@ test "async fn pointer in a struct field" {
bar: async fn (*i32) void,
};
var foo = Foo{ .bar = simpleAsyncFn2 };
- var bytes: [64]u8 = undefined;
+ var bytes: [64]u8 align(16) = undefined;
const f = @asyncCall(&bytes, {}, foo.bar, &data);
comptime expect(@typeOf(f) == anyframe->void);
expect(data == 2);
@@ -317,7 +317,7 @@ test "@asyncCall with return type" {
}
};
var foo = Foo{ .bar = Foo.middle };
- var bytes: [150]u8 = undefined;
+ var bytes: [150]u8 align(16) = undefined;
var aresult: i32 = 0;
_ = @asyncCall(&bytes, &aresult, foo.bar);
expect(aresult == 0);
diff --git a/test/stage1/behavior/new_stack_call.zig b/test/stage1/behavior/new_stack_call.zig
index 1e01a5a8a2..cbda9a2435 100644
--- a/test/stage1/behavior/new_stack_call.zig
+++ b/test/stage1/behavior/new_stack_call.zig
@@ -1,7 +1,7 @@
const std = @import("std");
const expect = std.testing.expect;
-var new_stack_bytes: [1024]u8 = undefined;
+var new_stack_bytes: [1024]u8 align(16) = undefined;
test "calling a function with a new stack" {
const arg = 1234;