Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can we just always (up)cast pointers to UInt64?
Browse files Browse the repository at this point in the history
tkf committed Oct 10, 2021
1 parent 2990b77 commit 6ca4eb5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/backtrace.jl
Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ NOTE: `f` and all functions reachable from `f` must not contain a yield point.
"""
function withalloca(f, nbytes)
function wrapper(int)
f(Ptr{Cvoid}(int))
f(Ptr{Cvoid}(UInt(int)))
nothing
end
closure = @cfunction($wrapper, Cvoid, (UInt64,))
@@ -288,9 +288,9 @@ function withalloca(f, nbytes)
"entry",
),
Cvoid,
Tuple{Ptr{Cvoid},Int64},
Base.unsafe_convert(Ptr{Cvoid}, closure),
nbytes,
Tuple{UInt64,UInt64},
UInt64(UInt(Base.unsafe_convert(Ptr{Cvoid}, closure))),
UInt64(nbytes),
)
end
end

2 comments on commit 6ca4eb5

@tkf
Copy link
Member Author

@tkf tkf commented on 6ca4eb5 Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: simple upcasting like UInt64(UInt(Base.unsafe_convert(Ptr{Cvoid}, closure))) works on Linux 32 https://build.julialang.org/#/builders/86/builds/4595

@vtjnash

This comment was marked as off-topic.

Please sign in to comment.