-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@embedFile corrupts compiler memory #22867
Comments
This may be a tad more broken than I first suspected:
Yep, the issue reproduces even if you only put ~35 MiB into the file. |
Ok, got a trace. As I suspected, it has something to do with the InternPool: Full trace
Glancing over the code, it seems that the string is simply "too big", and can't be stored in the internpool? AFAICT, the internpool index depends on the length of the string - and the maximum length is also dependant on Edit: the mask value/limit for the index is actually 67108863 |
Small nitpick: the precise limit seems to be 232 - const std = @import("std");
pub fn main() !void {
try std.io.getStdOut().writeAll("a" ** (1 << 28) ++ "a" ++ "b" ++ "c");
} The above snippet crashes for |
Zig Version
0.14.0-dev.3187+d4c85079c
Steps to Reproduce and Observed Behavior
First, write a program which uses @embedfile on something large.
In this example, I just dumped 1 GiB into the file.
Now, try to compile it.
![Image](https://private-user-images.githubusercontent.com/54503497/412285762-ab4b8b4a-92bf-4864-a2f8-3336c29e7e86.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjQ3MTcsIm5iZiI6MTczOTYyNDQxNywicGF0aCI6Ii81NDUwMzQ5Ny80MTIyODU3NjItYWI0YjhiNGEtOTJiZi00ODY0LWEyZjgtMzMzNmMyOWU3ZTg2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzMDAxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhYWEyYTZkY2YyY2ZiYjY5N2E3YzliODhiOTZjMmI5N2ZjMWExZmVkNmVkY2I4YjRiZTc0OWY0NjU1YTQ1YTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.x5QnHF4GpJ9ppmBMgGjyFkaEQAeGX9HIaC97c2A1udc)
In most cases, you get a bunch of compile-errors about types not having certain members:
Sometimes you get funny messages:
Expected Behavior
I expect the compiler to function as normal, and allow me to yeet whatever I want into my program.
The text was updated successfully, but these errors were encountered: