-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Closed
Copy link
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.
Milestone
Description
Zig Version
0.9.1
Steps to Reproduce
create the problematic file with these steps (sorry for including code to generate this, gh issue complains about too long body for this field)
$ cat bomb.zig
const assert = @import("std").debug.assert;
test "integer literals" {
// reading this 65537 ("0b" + 65535 "1"s) bytes long literal trips the compiler ...
const literal_maxbit_pattern: u65535 = 0bX;
assert(literal_maxbit_pattern > 0);
}
$ ones=$(head -c 65535 /dev/zero | tr '\0' '1');
$ sed -i bomb.zig -e "s;X;$ones;"
open something where you can see CPU and memory use (e.g. xosview, top, whatever)
then run the test:
zig test bomb.zig
Watch the resource usage explode.
Expected Behavior
test runs successfully
Actual Behavior
test run runs out of memory
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.