-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Compiler crash (SIGSEGV) with messed up @as()
and @splat()
#22321
Labels
bug
Observed behavior contradicts documented or intended behavior
Comments
pfgithub
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Dec 26, 2024
Stack trace of debug compiler: Output:
Fixing the crash seems easy enough: --- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -8614,7 +8614,8 @@ fn zirVecArrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
const pt = sema.pt;
const zcu = pt.zcu;
const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node;
- const vec_ty = sema.resolveType(block, LazySrcLoc.unneeded, un_node.operand) catch |err| switch (err) {
+ const src = block.nodeOffset(un_node.src_node);
+ const vec_ty = sema.resolveType(block, src, un_node.operand) catch |err| switch (err) {
// Since this is a ZIR instruction that returns a type, encountering
// generic poison should not result in a failed compilation, but the
// generic poison type. This prevents unnecessary failures when But this will result in the error pointing to the operand of the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zig Version
0.14.0-dev.2563+af5e73172
Steps to Reproduce and Observed Behavior
Expected Behavior
An error message, like:
expected type, found @Vector(2, f32)
.Interestingly, when the crash is averted, the error shows up in the wrong place:
The text was updated successfully, but these errors were encountered: