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

fix _crc32c used in loading.jl #38105

Merged
merged 1 commit into from
Oct 20, 2020
Merged

fix _crc32c used in loading.jl #38105

merged 1 commit into from
Oct 20, 2020

Conversation

KristofferC
Copy link
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
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
Member Author

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

@staticfloat
Copy link
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