add maximum value for @setAlignStack

This commit is contained in:
Andrew Kelley
2017-10-23 22:33:00 -04:00
parent c1642355f0
commit 643ab90ace
3 changed files with 13 additions and 1 deletions

View File

@@ -188,6 +188,6 @@ test "alignstack" {
}
fn fnWithAlignedStack() -> i32 {
@setAlignStack(1024);
@setAlignStack(256);
return 1234;
}

View File

@@ -2187,6 +2187,13 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
".tmp_source.zig:3:5: error: alignstack set twice",
".tmp_source.zig:2:5: note: first set here");
cases.add("@setAlignStack too big",
\\export fn entry() {
\\ @setAlignStack(511 + 1);
\\}
,
".tmp_source.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256");
cases.add("storing runtime value in compile time variable then using it",
\\const Mode = @import("builtin").Mode;
\\