Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
27 lines
789 B
Plaintext
27 lines
789 B
Plaintext
// Loop-body locals reuse one stack slot per frame: a body-declared local
|
|
// (and every compiler temp) must not grow the stack per iteration, so
|
|
// million-iteration loops run in constant stack. Covers body locals,
|
|
// nested loops (the inner loop's hidden index slot), and element reads.
|
|
// Regression (issue 0109): allocas were emitted at their use site, so each
|
|
// iteration re-executed them — LLVM only reclaims allocas at `ret`, and
|
|
// these loops segfaulted on stack exhaustion.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
main :: () -> i32 {
|
|
sum := 0;
|
|
for 0..1000000 (i) {
|
|
buf : [128]i64 = ---;
|
|
buf[0] = i;
|
|
sum += buf[0];
|
|
}
|
|
print("sum={}\n", sum);
|
|
|
|
n := 0;
|
|
for 0..3000000 (i) {
|
|
for 0..1 (j) { n += 1; }
|
|
}
|
|
print("n={}\n", n);
|
|
0
|
|
}
|