-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
pointer
fallback for AbstrctArray
s broken on master when using old idiom
#51962
Comments
pointer
fallback for AbstrctArrays brokenpointer
fallback for AbstrctArray
s broken on master when using old idiom
Calling pointer alone may segfault as it provides no way to insert a |
|
Yeah, I feel like we should have a special type in Base that just exists to have that cconvert / pair / unwrap semantics, if just to avoid the punning on I don't know why LayoutPointers.jl seems to invent its own scheme for this. The standard way to define this is that |
I did not know about any pre-existing schemes.
Thanks, I didn't know that. JuliaSIMD/LayoutPointers.jl@8be20b7 |
Is this undefined behavior? |
Both Ref's/RefValue's implementation has changed sometimes, and |
What are the recommended methods to be added here to resolve the issue in |
HDF5.jl is also encountering an issue with nightly. On Julia 1.10.2, this works: julia> Base.unsafe_convert(Ptr{UInt8}, reinterpret(UInt8, [true; false; false]))
Ptr{UInt8} @0x000070bfdb9e41f8 This no longer works on master: julia> Base.unsafe_convert(Ptr{UInt8}, reinterpret(UInt8, [true; false; false]))
ERROR: conversion to pointer not defined for Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false} The error occurs when passing a reinterpreted array to
|
* Add Julia 1.11 nightly to tests * Fix reinterpret arrays due to JuliaLang/julia#51962 * Mark Windows virtual dataset tests as broken
* Add Julia 1.11 nightly to tests * Fix reinterpret arrays due to JuliaLang/julia#51962 * Mark Windows virtual dataset tests as broken
FTR the Interfaces page in the Manual documents |
JuliaLang/julia#51962 (comment) > It is generally best to implement cconvert (since it is not unsafe), > and generally required to call both functions as well (mimicking the > behavior defined for ccall)
It was common to define
e.g.
https://github.com/JuliaArrays/OffsetArrays.jl/blob/a2e68178c5a3233f3d1a7aba39f2a659509574f8/src/OffsetArrays.jl#L464
but the change in behavior of
unsafe_convert
breaks both old methods of getting a pointer:pointer
andunsafe_convert
.We used to have
in Base, but it is now implemented as
so it seems like
unsafe_convert
was considered internal and isn't a supported means of getting pointers.What is the recommended solution?
This causes breakages such as FluxML/NNlib.jl#540 (comment)
I can update packages that called
unsafe_convert
as an end user, such as LayoutPointers.jl and TriangularSolve.jl, but updating all the packages defining their own pointer methods in terms ofunsafe_convert
could be a taller order.The text was updated successfully, but these errors were encountered: