Skip to content

Slices segfaults and compiler crashes #3449

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

Closed
nrdmn opened this issue Oct 13, 2019 · 1 comment
Closed

Slices segfaults and compiler crashes #3449

nrdmn opened this issue Oct 13, 2019 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@nrdmn
Copy link
Contributor

nrdmn commented Oct 13, 2019

While investigating #3444 I stumbled over this behavior:

pub fn main() void {
    var x = "foo";
    x = x[1..];
}
$ zig build-exe test.zig 
broken LLVM module found: Stored value type does not match pointer operand type!
  store i8* %2, i8* %1, !dbg !14121
 i8Stored value type does not match pointer operand type!
  store i64 2, i8* %3, !dbg !14121
 i8
Unable to dump stack trace: debug info stripped
Aborted

When discarding the result of x[1..] I get a segfault instead:

pub fn main() void {
    var x = "foo";
    _ = x[1..];
}
$ zig build-exe test.zig 
Segmentation fault
@andrewrk andrewrk added this to the 0.6.0 milestone Oct 14, 2019
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend. labels Oct 14, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 18, 2020
@xackus
Copy link
Contributor

xackus commented May 9, 2020

Works correctly as of d4d5090.

@Vexu Vexu closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

4 participants