-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
stage2 segfault slicing zero length array field of struct #11787
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
Comments
I've done a bunch of digging, and while I think I have narrowed the problem down to at least understand what's happening, I'm not sure what the best approach is for a fix. The segfault comes from a failed assertion:
in the call to Lines 6609 to 6614 in a12abc6
There were two things that I was confused about: (1) why (1) is due to Lines 2561 to 2570 in a12abc6
I.e. we're lowering pointers to all zero-sized types to (2) is due to Lines 8899 to 8911 in a12abc6
From what I can tell, LLVM is complaining about the indices because we're indexing with a The lowering to Code to reproduceconst S = struct {
a: [0]usize,
};
fn foo(s: *S, start: usize, end: usize) []usize {
return s.a[start..end];
}
pub export fn entry() void {
var s = S{ .a = .{}, };
_ = foo(&s, 0, 0);
} AIR for the snippet
Full stack trace
|
This is no longer crashing |
Segfault happens in LLVM when doing
buildInBoundsGEP
inairPtrAdd
.The text was updated successfully, but these errors were encountered: