Skip to content
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

release-1.6: Backports for Julia 1.6.8 #46116

Open
wants to merge 54 commits into
base: release-1.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
161c26c
fix convert call in Artifacts.jl (#46040)
KristofferC Jul 14, 2022
1fa0450
Allow `BUILDKITE_BRANCH` to provide branch name (#46053)
staticfloat Jul 15, 2022
a82257d
Fix sparse constructor when `Tridiagonal`/`SymTridiagonal` are empty …
mcognetta Oct 15, 2021
94bc7bf
Fix implicit binding import for aliased bindings (#44827)
Pangoraw Apr 2, 2022
b6acfc7
`Base.stale_cachefile`: allow `ftime_req` to be greater than `ftime` …
DilumAluthge Jun 17, 2022
b21a8bb
Fix union!(s::BitSet, r::AbstractUnitRange{<:Integer}) when two range…
metab0t Aug 29, 2022
8e0933b
Replace isfinite check in ranges with lo ≤ x ≤ hi (#45646)
LilithHafner Oct 3, 2022
89661ac
Check sizes in 3-arg diagonal (dot-)product (#47114)
dkarrasch Oct 10, 2022
c26ce31
make REPL completions robust against `expanduser` throwing (#47058)
KristofferC Oct 10, 2022
f3d87d5
Better Libdl.dlopen error when using non-standard extension (#46998)
fingolfin Oct 25, 2022
cb71669
CircleCI caching: allow ftime to be ceil(ftime_req) in Base.stale_cac…
nrontsis Nov 4, 2022
a9367cb
Merge pull request #47940 from Seelengrab/bump_pcre
KristofferC Dec 21, 2022
63e30db
leq for reals falls back to le and eq (#46341)
jishnub Aug 17, 2022
b492b93
fix #45903, in place broadcast into a bit-masked bitmatrix (#45904)
mbauman Jul 5, 2022
9b90553
Use Documenter 0.27.23 (#46516)
mortenpi Aug 29, 2022
9f6f76f
fix unescaping in `global` expressions (#47719)
simeonschaub Dec 1, 2022
1d1e82e
Fix generator-invocation legality check for varargs generators (#47739)
Keno Nov 29, 2022
97ea252
Removed attributes from arguments to gc_preserve_begin (#47482)
apaz-cli Nov 8, 2022
ac06470
union-types: use insertion (stable) sort instead of qsort (#45896)
vtjnash Jul 6, 2022
e03f890
Handle `PhiNode` with `edge==0` (#46388)
martinholters Aug 18, 2022
2c38119
Don't crash on variable sized gc allocations (#46914)
wsmoses Sep 26, 2022
3f85dc1
cgmemmgr: check rlimit before using map_size_inc to map more memory (…
srz-zumix Apr 3, 2021
fc6a4f0
cgmemmgr,macos: add missing shared_map_lock initialization
vtjnash Nov 1, 2022
b2e7307
Fix REPL keybinding CTRL-Q for stdlib methods (#47637)
rashidrafeek Nov 28, 2022
a954bc7
Set `intersection = 1` during `intersect_sub_datatype` (#46882)
N5N3 Sep 24, 2022
783d152
fix rem2pi for non-finite arguments (#46163)
oscardssmith Jul 25, 2022
bb60877
bugfix: fld1 order of ops (#46938)
JeffreySarnoff Oct 3, 2022
284bad1
`copyto!` fix for `BitArray`/`AbstractArray`, fixes #25968 (#46161)
N5N3 Jul 25, 2022
0b4201d
Fix GC assertion on array of derived pointers (#47299)
wsmoses Oct 25, 2022
3aa7b9a
Fix integer overflow in `reverse!` (#45871)
jishnub Jun 30, 2022
3cfa748
Fix isdone for empty product iterators, fixes #43921 (#43947)
sasi591 Nov 3, 2022
bae7300
Complete size checks in `BLAS.[sy/he]mm!` (#45605)
dkarrasch Jul 7, 2022
b901d10
Set `OPENBLAS_NUM_THREADS=1` on local Distributed workers (#47803)
staticfloat Dec 5, 2022
2ac3541
build: improve parsing of gfortran version (#47352)
apaz-cli Nov 15, 2022
5476d49
1.6: add some `.gitignore` entries, including some Buildkite-related …
DilumAluthge Dec 21, 2022
dfb43fa
Switch to 1.6-specific buildkite configuration branch
staticfloat Dec 21, 2022
ef6cec6
Disable MSYS2's path munging for `stringreplace` (#46803)
staticfloat Sep 17, 2022
c82830a
[win] Disable MSYS2 path munging when calling `is.exe` (#46867)
staticfloat Sep 26, 2022
f174db2
Build/win: Build with MSYS2 (#46140)
inkydragon Sep 14, 2022
dbc7733
Backport `llvm-config` path fix
staticfloat Dec 21, 2022
ae9b454
[release-1.6] Disable affinity testing when run inside of cpusets (#4…
staticfloat Dec 23, 2022
3e977c8
[release-1.6] Eliminate outdated test
staticfloat Dec 24, 2022
3fb302e
bump Pkg to latest v1.6
KristofferC Dec 27, 2022
248bef5
SparseArrays: Fix order of triangular and adjortrans wrappers
dkarrasch Nov 2, 2022
8024e28
test with new Pkg
Oct 11, 2023
d3791a0
follow up #47739 (#47746)
aviatesk Nov 30, 2022
53dfef5
Generalize Bool parse method to AbstractString (#47782)
quinnj Dec 6, 2022
2dd9aac
deps: fix broken `p7zip` url (#48176)
t-bltg Jan 8, 2023
03bbc23
doc: remove outdata const (#49096)
inkydragon Mar 22, 2023
927cd05
Mark llvm::Any::TypeId as global in julia.expmap (#49124)
vchuravy Mar 28, 2023
6549459
Make :open ccall use variadic cconv (#49212)
vchuravy Apr 1, 2023
65a12ef
Remove xsaves from Zen cpuspec (#50186)
vchuravy Jun 15, 2023
fb2fd0b
Ryu: make sure adding zeros does not overwrite trailing dot (#51254)
vtjnash Sep 12, 2023
8608783
bump libcurl to CVE patched version
Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite-external-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
main
release-julia-1.6
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*.so
*.dylib
*.dSYM
*.h.gen
*.jl.cov
*.jl.*.cov
*.jl.mem
Expand All @@ -32,9 +33,13 @@
.DS_Store
.idea/*
.vscode/*
*.heapsnapshot

# Buildkite: cryptic plugin
# Ignore the unencrypted repo_key
# Buildkite: Ignore the entire .buildkite directory
/.buildkite

# Buildkite: Ignore the unencrypted repo_key
repo_key
# Ignore any agent keys (public or private) we have stored

# Buildkite: Ignore any agent keys (public or private) we have stored
agent_key*
15 changes: 10 additions & 5 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ LLVM_CONFIG_PATH_FIX := PATH="$(build_bindir):$(PATH)"
endif

ifeq ($(BUILD_OS),$(OS))
LLVM_CONFIG_HOST := $(LLVM_CONFIG)
LLVM_CONFIG_HOST := $(LLVM_CONFIG_PATH_FIX) $(LLVM_CONFIG)
else
LLVM_CONFIG_HOST := $(basename $(LLVM_CONFIG))-host$(BUILD_EXE)
ifeq (exists, $(shell [ -f '$(LLVM_CONFIG_HOST)' ] && echo exists ))
Expand Down Expand Up @@ -1188,7 +1188,12 @@ USE_BINARYBUILDER ?= 0
endif

# Auto-detect triplet once, create different versions that we use as defaults below for each BB install target
BB_TRIPLET_LIBGFORTRAN_CXXABI := $(shell $(call invoke_python,$(JULIAHOME)/contrib/normalize_triplet.py) $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) "$(shell $(FC) --version | head -1)" "$(or $(shell echo '\#include <string>' | $(CXX) $(CXXFLAGS) -x c++ -dM -E - | grep _GLIBCXX_USE_CXX11_ABI | awk '{ print $$3 }' ),1)")
FC_VERSION := $(shell $(FC) -dM -E - < /dev/null | grep __GNUC__ | cut -d' ' -f3)
ifeq ($(USEGCC)$(FC_VERSION),1)
FC_OR_CC_VERSION := $(shell $(CC) -dumpfullversion -dumpversion 2>/dev/null | cut -d'.' -f1)
# n.b. clang's __GNUC__ macro pretends to be gcc 4.2.1, so leave it as the empty string here if the compiler is not certain to be GCC
endif
BB_TRIPLET_LIBGFORTRAN_CXXABI := $(shell $(call invoke_python,$(JULIAHOME)/contrib/normalize_triplet.py) $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) "$(FC_OR_CC_VERSION)" "$(or $(shell echo '\#include <string>' | $(CXX) $(CXXFLAGS) -x c++ -dM -E - | grep _GLIBCXX_USE_CXX11_ABI | awk '{ print $$3 }' ),1)")
BB_TRIPLET_LIBGFORTRAN := $(subst $(SPACE),-,$(filter-out cxx%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRAN_CXXABI))))
BB_TRIPLET_CXXABI := $(subst $(SPACE),-,$(filter-out libgfortran%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRAN_CXXABI))))
BB_TRIPLET := $(subst $(SPACE),-,$(filter-out cxx%,$(filter-out libgfortran%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRAN_CXXABI)))))
Expand Down Expand Up @@ -1492,13 +1497,13 @@ define symlink_target # (from, to-dir, to-name)
CLEAN_TARGETS += clean-$$(abspath $(2)/$(3))
clean-$$(abspath $(2)/$(3)):
ifeq ($(BUILD_OS), WINNT)
-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&)
-cmd //C rmdir $$(call cygpath_w,$(2)/$(3))
else
-rm -r $$(abspath $(2)/$(3))
endif
$$(abspath $(2)/$(3)): | $$(abspath $(2))
ifeq ($$(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&) $$(call mingw_to_dos,$(1),)
@cmd //C mklink //J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifneq (,$$(findstring CYGWIN,$$(BUILD_OS)))
@cmd /C mklink /J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifdef JULIA_VAGRANT_BUILD
Expand All @@ -1513,7 +1518,7 @@ endef
# many of the following targets must be = not := because the expansion of the makefile functions (and $1) shouldn't happen until later
ifeq ($(BUILD_OS), WINNT) # MSYS
spawn = $(1)
cygpath_w = $(1)
cygpath_w = `cygpath -w $(1)`
else ifneq (,$(findstring CYGWIN,$(BUILD_OS))) # Cygwin
spawn = $(1)
cygpath_w = `cygpath -w $(1)`
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ endif
endif
endif

# Note that we disable MSYS2's path munging here, as otherwise
# it replaces our `:`-separated list as a `;`-separated one.
define stringreplace
$(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
MSYS2_ARG_CONV_EXCL='*' $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
endef


Expand Down Expand Up @@ -430,8 +432,9 @@ endif
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)

exe:
# run Inno Setup to compile installer
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
# run Inno Setup to compile installer.
# Note that we disable MSYS2 path munging, as it interferes with the `/` options:
MSYS2_ARG_CONV_EXCL='*' $(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"

app:
Expand Down Expand Up @@ -556,7 +559,7 @@ win-extras:
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
chmod a+x is.exe && \
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
MSYS2_ARG_CONV_EXCL='*' $(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)

# various statistics about the build that may interest the user
ifeq ($(USE_SYSTEM_LLVM), 1)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Library changes
* `RegexMatch` objects can now be probed for whether a named capture group exists within it through `haskey()` ([#36717]).
* For consistency `haskey(r::RegexMatch, i::Integer)` has also been added and returns if the capture group
for `i` exists ([#37300]).
* An issue with order of operations in `fld1` is now fixed ([#28973]).

Standard library changes
------------------------
Expand Down
15 changes: 8 additions & 7 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,13 +820,12 @@ See also [`copyto!`](@ref).
is available from the `Future` standard library as `Future.copy!`.
"""
function copy!(dst::AbstractVector, src::AbstractVector)
firstindex(dst) == firstindex(src) || throw(ArgumentError(
"vectors must have the same offset for copy! (consider using `copyto!`)"))
if length(dst) != length(src)
resize!(dst, length(src))
end
for i in eachindex(dst, src)
@inbounds dst[i] = src[i]
end
dst
copyto!(dst, src)
end

function copy!(dst::AbstractArray, src::AbstractArray)
Expand Down Expand Up @@ -1014,8 +1013,9 @@ function copyto!(dest::AbstractArray, dstart::Integer,
destinds, srcinds = LinearIndices(dest), LinearIndices(src)
(checkbounds(Bool, destinds, dstart) && checkbounds(Bool, destinds, dstart+n-1)) || throw(BoundsError(dest, dstart:dstart+n-1))
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
@inbounds for i = 0:(n-1)
dest[dstart+i] = src[sstart+i]
src′ = unalias(dest, src)
@inbounds for i = 0:n-1
dest[dstart+i] = src′[sstart+i]
end
return dest
end
Expand All @@ -1037,11 +1037,12 @@ function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::A
end
@boundscheck checkbounds(B, ir_dest, jr_dest)
@boundscheck checkbounds(A, ir_src, jr_src)
A′ = unalias(B, A)
jdest = first(jr_dest)
for jsrc in jr_src
idest = first(ir_dest)
for isrc in ir_src
@inbounds B[idest,jdest] = A[isrc,jsrc]
@inbounds B[idest,jdest] = A[isrc,jsrc]
idest += step(ir_dest)
end
jdest += step(jr_dest)
Expand Down
28 changes: 17 additions & 11 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,11 @@ function reverseind(a::AbstractVector, i::Integer)
first(li) + last(li) - i
end

# This implementation of `midpoint` is performance-optimized but safe
# only if `lo <= hi`.
midpoint(lo::T, hi::T) where T<:Integer = lo + ((hi - lo) >>> 0x01)
midpoint(lo::Integer, hi::Integer) = midpoint(promote(lo, hi)...)

"""
reverse!(v [, start=1 [, stop=length(v) ]]) -> v

Expand Down Expand Up @@ -1687,17 +1692,18 @@ julia> A
"""
function reverse!(v::AbstractVector, start::Integer, stop::Integer=lastindex(v))
s, n = Int(start), Int(stop)
liv = LinearIndices(v)
if n <= s # empty case; ok
elseif !(first(liv) ≤ s ≤ last(liv))
throw(BoundsError(v, s))
elseif !(first(liv) ≤ n ≤ last(liv))
throw(BoundsError(v, n))
end
r = n
@inbounds for i in s:div(s+n-1, 2)
v[i], v[r] = v[r], v[i]
r -= 1
if n > s # non-empty and non-trivial
liv = LinearIndices(v)
if !(first(liv) ≤ s ≤ last(liv))
throw(BoundsError(v, s))
elseif !(first(liv) ≤ n ≤ last(liv))
throw(BoundsError(v, n))
end
r = n
@inbounds for i in s:midpoint(s, n-1)
v[i], v[r] = v[r], v[i]
r -= 1
end
end
return v
end
Expand Down
5 changes: 3 additions & 2 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,11 @@ function unsafe_copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Arra
return dest
end

copyto!(dest::BitArray, doffs::Integer, src::Array, soffs::Integer, n::Integer) =
copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Array}, soffs::Integer, n::Integer) =
_copyto_int!(dest, Int(doffs), src, Int(soffs), Int(n))
function _copyto_int!(dest::BitArray, doffs::Int, src::Array, soffs::Int, n::Int)
function _copyto_int!(dest::BitArray, doffs::Int, src::Union{BitArray,Array}, soffs::Int, n::Int)
n == 0 && return dest
n < 0 && throw(ArgumentError("Number of elements to copy must be nonnegative."))
soffs < 1 && throw(BoundsError(src, soffs))
doffs < 1 && throw(BoundsError(dest, doffs))
soffs+n-1 > length(src) && throw(BoundsError(src, length(src)+1))
Expand Down
14 changes: 2 additions & 12 deletions base/bitset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,10 @@ function union!(s::BitSet, r::AbstractUnitRange{<:Integer})

# grow s.bits as necessary
if diffb >= len
_growend!(s.bits, diffb - len + 1)
# we set only some values to CHK0, those which will not be
# fully overwritten (i.e. only or'ed with `|`)
s.bits[end] = CHK0 # end == diffb + 1
if diffa >= len
s.bits[diffa + 1] = CHK0
end
_growend0!(s.bits, diffb - len + 1)
end
if diffa < 0
_growbeg!(s.bits, -diffa)
s.bits[1] = CHK0
if diffb < 0
s.bits[diffb - diffa + 1] = CHK0
end
_growbeg0!(s.bits, -diffa)
s.offset = cidxa # s.offset += diffa
diffb -= diffa
diffa = 0
Expand Down
2 changes: 1 addition & 1 deletion base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ Base.@propagate_inbounds dotview(B::BitArray, i::BitArray) = BitMaskedBitArray(B
Base.show(io::IO, B::BitMaskedBitArray) = foreach(arg->show(io, arg), (typeof(B), (B.parent, B.mask)))
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}}) = fill!(B, bc.args[1])
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(SubArray(B.parent, to_indices(B.parent, (B.mask,))), bc)
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(@inbounds(view(B.parent, B.mask)), bc)
function Base.fill!(B::BitMaskedBitArray, b::Bool)
Bc = B.parent.chunks
Ic = B.mask.chunks
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/ssair/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function replace_code_newstyle!(ci::CodeInfo, ir::IRCode, nargs::Int)
elseif isa(stmt, GotoIfNot)
stmt = GotoIfNot(stmt.cond, first(ir.cfg.blocks[stmt.dest].stmts))
elseif isa(stmt, PhiNode)
stmt = PhiNode(Int32[last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
stmt = PhiNode(Int32[edge == 0 ? 0 : last(ir.cfg.blocks[edge].stmts) for edge in stmt.edges], stmt.values)
elseif isa(stmt, Expr) && stmt.head === :enter
stmt.args[1] = first(ir.cfg.blocks[stmt.args[1]::Int].stmts)
end
Expand Down
2 changes: 1 addition & 1 deletion base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if Sys.iswindows()
end
else
function cd(f::Function, dir::AbstractString)
fd = ccall(:open, Int32, (Cstring, Int32), :., 0)
fd = ccall(:open, Int32, (Cstring, Int32, UInt32...), :., 0)
systemerror(:open, fd == -1)
try
cd(dir)
Expand Down
1 change: 1 addition & 0 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ iterate(::ProductIterator{Tuple{}}, state) = nothing
done1 === true || return done1 # false or missing
return _pisdone(tail(iters), tail(states)) # check tail
end
@inline isdone(::ProductIterator{Tuple{}}, states) = true
@inline isdone(P::ProductIterator, states) = _pisdone(P.iterators, states)

@inline _piterate() = ()
Expand Down
11 changes: 7 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1794,11 +1794,14 @@ function stale_cachefile(modpath::String, cachefile::String; ignore_loaded = fal
end
for chi in includes
f, ftime_req = chi.filename, chi.mtime
# Issue #13606: compensate for Docker images rounding mtimes
# Issue #20837: compensate for GlusterFS truncating mtimes to microseconds
# The `ftime != 1.0` condition below provides compatibility with Nix mtime.
ftime = mtime(f)
if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6) && ftime != 1.0
is_stale = ( ftime != ftime_req ) &&
( ftime != floor(ftime_req) ) && # Issue #13606, PR #13613: compensate for Docker images rounding mtimes
( ftime != ceil(ftime_req) ) && # PR: #47433 Compensate for CirceCI's truncating of timestamps in its caching
( ftime != trunc(ftime_req, digits=6) ) && # Issue #20837, PR #20840: compensate for GlusterFS truncating mtimes to microseconds
( ftime != 1.0 ) && # PR #43090: provide compatibility with Nix mtime.
!( 0 < (ftime_req - ftime) < 1e-6 ) # PR #45552: Compensate for Windows tar giving mtimes that may be incorrect by up to one microsecond
if is_stale
@debug "Rejecting stale cache file $cachefile (mtime $ftime_req) because file $f (mtime $ftime) has changed"
return true
end
Expand Down
8 changes: 8 additions & 0 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,8 @@ julia> rem2pi(7pi/4, RoundDown)
"""
function rem2pi end
function rem2pi(x::Float64, ::RoundingMode{:Nearest})
isfinite(x) || return NaN

abs(x) < pi && return x

n,y = rem_pio2_kernel(x)
Expand All @@ -1012,6 +1014,8 @@ function rem2pi(x::Float64, ::RoundingMode{:Nearest})
end
end
function rem2pi(x::Float64, ::RoundingMode{:ToZero})
isfinite(x) || return NaN

ax = abs(x)
ax <= 2*Float64(pi,RoundDown) && return x

Expand All @@ -1037,6 +1041,8 @@ function rem2pi(x::Float64, ::RoundingMode{:ToZero})
copysign(z,x)
end
function rem2pi(x::Float64, ::RoundingMode{:Down})
isfinite(x) || return NaN

if x < pi4o2_h
if x >= 0
return x
Expand Down Expand Up @@ -1066,6 +1072,8 @@ function rem2pi(x::Float64, ::RoundingMode{:Down})
end
end
function rem2pi(x::Float64, ::RoundingMode{:Up})
isfinite(x) || return NaN

if x > -pi4o2_h
if x <= 0
return x
Expand Down
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
true
```
"""
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld(x + y - m, y))
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld((x - m) + y, y))
function fld1(x::T, y::T) where T<:Integer
d = div(x, y)
return d + (!signbit(x ⊻ y) & (d * y != x))
Expand Down
15 changes: 10 additions & 5 deletions base/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function tryparse_internal(::Type{T}, s::AbstractString, startpos::Int, endpos::
return n
end

function tryparse_internal(::Type{Bool}, sbuff::Union{String,SubString{String}},
function tryparse_internal(::Type{Bool}, sbuff::AbstractString,
startpos::Int, endpos::Int, base::Integer, raise::Bool)
if isempty(sbuff)
raise && throw(ArgumentError("input string is empty"))
Expand All @@ -202,10 +202,15 @@ function tryparse_internal(::Type{Bool}, sbuff::Union{String,SubString{String}},
end

len = endpos - startpos + 1
p = pointer(sbuff) + startpos - 1
GC.@preserve sbuff begin
(len == 4) && (0 == _memcmp(p, "true", 4)) && (return true)
(len == 5) && (0 == _memcmp(p, "false", 5)) && (return false)
if sbuff isa Union{String, SubString{String}}
p = pointer(sbuff) + startpos - 1
GC.@preserve sbuff begin
(len == 4) && (0 == _memcmp(p, "true", 4)) && (return true)
(len == 5) && (0 == _memcmp(p, "false", 5)) && (return false)
end
else
(len == 4) && (SubString(sbuff, startpos:startpos+3) == "true") && (return true)
(len == 5) && (SubString(sbuff, startpos:startpos+4) == "false") && (return false)
end

if raise
Expand Down
2 changes: 1 addition & 1 deletion base/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ xor(x::T, y::T) where {T<:Integer} = no_op_err("xor", T)

(==)(x::T, y::T) where {T<:Number} = x === y
(< )(x::T, y::T) where {T<:Real} = no_op_err("<" , T)
(<=)(x::T, y::T) where {T<:Real} = no_op_err("<=", T)
(<=)(x::T, y::T) where {T<:Real} = (x == y) | (x < y)

rem(x::T, y::T) where {T<:Real} = no_op_err("rem", T)
mod(x::T, y::T) where {T<:Real} = no_op_err("mod", T)
Expand Down
15 changes: 7 additions & 8 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1073,14 +1073,13 @@ function sum(r::AbstractRange{<:Real})
end

function _in_range(x, r::AbstractRange)
if !isfinite(x)
return false
elseif iszero(step(r))
return !isempty(r) && first(r) == x
else
n = round(Integer, (x - first(r)) / step(r)) + 1
return n >= 1 && n <= length(r) && r[n] == x
end
isempty(r) && return false
f, l = first(r), last(r)
# check for NaN, Inf, and large x that may overflow in the next calculation
f <= x <= l || l <= x <= f || return false
iszero(step(r)) && return true
n = round(Integer, (x - f) / step(r)) + 1
n >= 1 && n <= length(r) && r[n] == x
end
in(x::Real, r::AbstractRange{<:Real}) = _in_range(x, r)
# This method needs to be defined separately since -(::T, ::T) can be implemented
Expand Down
Loading