This commit is contained in:
agra
2026-03-05 16:20:36 +02:00
parent 22bc2439ce
commit f9dda972d2
36 changed files with 1063 additions and 7 deletions

28
examples/issue-0015.sx Normal file
View File

@@ -0,0 +1,28 @@
// issue-0015: Global array variables with initializers contain all zeros at runtime.
//
// Expected: VALS[0]=-2, VALS[1]=-1, VALS[2]=42
// Actual: VALS[0]=0, VALS[1]=0, VALS[2]=0
//
// Global arrays declared with `: [N]T = .[...]` syntax get zero-initialized
// instead of receiving their specified values.
#import "modules/std.sx";
VALS : [4]s32 = .[-2, -1, 42, 99];
main :: () {
out("VALS: ");
i := 0;
while i < 4 {
out(int_to_string(xx VALS[i]));
out(" ");
i = i + 1;
}
out("\n");
if VALS[0] == -2 and VALS[1] == -1 and VALS[2] == 42 and VALS[3] == 99 {
out("PASS\n");
} else {
out("FAIL: global array not initialized\n");
}
}