-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviormiscompilationThe compiler reports success but produces semantically incorrect code.The compiler reports success but produces semantically incorrect code.stage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.
Milestone
Description
Below, the mem.cpy segfaults as the ptr in the buffer[0..] slice results as 0x0 (seems to only be visible in debuggers while printing out with std.debug.warn gives the correct address). Other code shows the slice ptr being the first byte of the address and not necessarily 0x0.
const std = @import("std");
threadlocal var buffer: [42]u8 = undefined;
pub fn main() void {
std.mem.copy(u8, buffer[0..], "Hello world");
}Was not able to reproduce on windows, macosx, and linux with --single-threaded. Getting the slice using the method below appears to provide the correct address however.
const buf = @intToPtr([*]u8, @ptrToInt(&buffer[0]))[0..buffer.len];Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviormiscompilationThe compiler reports success but produces semantically incorrect code.The compiler reports success but produces semantically incorrect code.stage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.