Skip to content

Commit

Permalink
Fix #40318 by using UInt to convert instead of Int on Ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Apr 2, 2021
1 parent 878e1cd commit 0d9163b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/Printf/src/Printf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ const __BIG_FLOAT_MAX__ = 8192
end

# pointers
fmt(buf, pos, arg, spec::Spec{Pointer}) = fmt(buf, pos, Int(arg), ptrfmt(spec, arg))
fmt(buf, pos, arg, spec::Spec{Pointer}) = fmt(buf, pos, UInt(arg), ptrfmt(spec, arg))

# old Printf compat
function fix_dec end
Expand Down
3 changes: 3 additions & 0 deletions stdlib/Printf/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ using Test, Printf
@test (@sprintf "%-20p" C_NULL) == "0x00000000 "
end

#40318
@test @sprintf("%p", 0xfffffffffffe0000) == "0xfffffffffffe0000"

end

@testset "%a" begin
Expand Down

0 comments on commit 0d9163b

Please sign in to comment.