Skip to content

Commit 5bd2972

Browse files
quinnjKristofferC
authored andcommitted
Fix #40318 by using UInt to convert instead of Int on Ptr
(cherry picked from commit 0d9163b)
1 parent 1317280 commit 5bd2972

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stdlib/Printf/src/Printf.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ const __BIG_FLOAT_MAX__ = 8192
547547
end
548548

549549
# pointers
550-
fmt(buf, pos, arg, spec::Spec{Pointer}) = fmt(buf, pos, Int(arg), ptrfmt(spec, arg))
550+
fmt(buf, pos, arg, spec::Spec{Pointer}) = fmt(buf, pos, UInt(arg), ptrfmt(spec, arg))
551551

552552
# old Printf compat
553553
function fix_dec end

stdlib/Printf/test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ using Test, Printf
1919
@test (@sprintf "%-20p" C_NULL) == "0x00000000 "
2020
end
2121

22+
#40318
23+
@test @sprintf("%p", 0xfffffffffffe0000) == "0xfffffffffffe0000"
24+
2225
end
2326

2427
@testset "%a" begin

0 commit comments

Comments
 (0)