Skip to content

fix _crc32c used in loading.jl#38105

Merged
staticfloat merged 1 commit intomasterfrom
kc/crc
Oct 20, 2020
Merged

fix _crc32c used in loading.jl#38105
staticfloat merged 1 commit intomasterfrom
kc/crc

Conversation

@KristofferC
Copy link
Copy Markdown
Member

@KristofferC KristofferC commented Oct 20, 2020

Previously:

julia> crc, x = 0x6635934445471676, 0x5202ff58;

julia> Base._crc32c(crc, x)
0x8b058d60

julia> Base._crc32c(crc, x)
0x2bcaa1e5

julia> Base._crc32c(crc, x)
0xdc2d7c70

Problem is that Vector instead of Ptr was used. Here I just simplified this to handle the return value of hash (UInt64) which is the only thing we use (this also avoids forming the [x]).

Fixes #38101.

@JeffBezanson JeffBezanson added the bugfix This change fixes an existing bug label Oct 20, 2020
@KristofferC KristofferC changed the title fix usage of _crc32c in loading.jl fix _crc32c used in loading.jl Oct 20, 2020
@staticfloat
Copy link
Copy Markdown
Member

Oops. Why is this a problem?

@staticfloat staticfloat merged commit 0a1cbec into master Oct 20, 2020
@staticfloat staticfloat deleted the kc/crc branch October 20, 2020 17:12
@KristofferC
Copy link
Copy Markdown
Member Author

The C function expects a pointer so giving it a julia array likely makes it read the wrong stuff.

@staticfloat
Copy link
Copy Markdown
Member

Oh, of course, right, the type passed to ccall() needs to be Ptr{eltype} (or Ref{eltype}) in order to skip the Julia object metadata, not Vector{eltype}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Base.compilecache_path is misbehaving

4 participants