Skip to content
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

assert fail when "implicitly" casting to [N]u8 from []const u8 #2870

Closed
lun-4 opened this issue Jul 11, 2019 · 1 comment
Closed

assert fail when "implicitly" casting to [N]u8 from []const u8 #2870

lun-4 opened this issue Jul 11, 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

@lun-4
Copy link
Contributor

lun-4 commented Jul 11, 2019

Unsure if this is a duplicate. Maybe related to #2749?

const std = @import("std");

const S = struct {
    field: [50]u8,
};

pub fn main() !void {
    var p = try std.heap.direct_allocator.alloc(u8, 1024);
    const pc = p;
    const s = S{ .field = pc[0..] };
}
#6  0x0000000000b41411 in assert (ok=false) at src/util.cpp:28
#7  0x0000000000a8b99b in ir_render_slice (g=0x375c040, executable=0x9ab0f88, instruction=0x9c7f700) at src/codegen.cpp:4751
#8  0x0000000000a8f584 in ir_render_instruction (g=0x375c040, executable=0x9ab0f88, instruction=0x9c7f700) at src/codegen.cpp:5707
#9  0x0000000000a8fca2 in ir_render (g=0x375c040, fn_entry=0x9ab0e30) at src/codegen.cpp:5833
#10 0x0000000000a94e11 in do_code_gen (g=0x375c040) at src/codegen.cpp:7010
@andrewrk andrewrk added this to the 0.5.0 milestone Jul 12, 2019
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Jul 12, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 25, 2019
@andrewrk andrewrk added the stage1 The process of building from source via WebAssembly and the C backend. label Feb 10, 2020
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 10, 2020
@lun-4
Copy link
Contributor Author

lun-4 commented Mar 27, 2020

Nowadays that causes a compile error (likely after the slice/array safety changes), which is better than an assert trip.

@lun-4 lun-4 closed this as completed Mar 27, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Mar 29, 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

2 participants