You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Slicing with length of 0 returns a slice with .len = 0, .ptr = undefined. See #4771 for discussion on that.
This issue is probably related, but when testing I found out that sentinel-terminated slices actually work, so I can't find a source of UB anywhere in what I'm doing. Test case:
Inspecting the addresses with std.debug.print, comptime_known_array_value and runtime_array_value have the same address... whatever that means.
My best explanation would be that the compiler gets confused over whether it needs to separately allocate and copy the sub-array or not, and so that memory is left uninitialized.
The text was updated successfully, but these errors were encountered:
rohlem
changed the title
Stage1 bug: statically-sliced runtime *[0:S]T doesn't point to sentinel
Stage1 bug: runtime copy of statically-dereferenced *[0:S]T doesn't hold sentinel
Nov 1, 2020
andrewrk
added
bug
Observed behavior contradicts documented or intended behavior
stage1
The process of building from source via WebAssembly and the C backend.
labels
Nov 1, 2020
Uh oh!
There was an error while loading. Please reload this page.
Slicing with length of 0 returns a slice with
.len = 0, .ptr = undefined
. See #4771 for discussion on that.This issue is probably related, but when testing I found out that sentinel-terminated slices actually work, so I can't find a source of UB anywhere in what I'm doing. Test case:
Inspecting the addresses with
std.debug.print
,comptime_known_array_value
andruntime_array_value
have the same address... whatever that means.My best explanation would be that the compiler gets confused over whether it needs to separately allocate and copy the sub-array or not, and so that memory is left uninitialized.
The text was updated successfully, but these errors were encountered: