Skip to content

Pointer hashing breaks equality #26038

@chethega

Description

@chethega
p0=reinterpret(Ptr{Int8},0)
isequal(p0,C_NULL)
#true 
isequal(hash(p0),hash(C_NULL))
#false 

both on 0.62 and current 0.7.

I feel silly about opening so many small hashing-related issues (and apologize for spamming the tracker); if there is a more appropriate meta-issue for collecting these, could anyone tell me and/or move this to there? [this one is actually not so pathological: using pointers as keys in a dict makes sense; but then they should all be turned into void-pointers for type-stability anyway, at least as long as two pointers of different types to the same address are isequal]

Metadata

Metadata

Assignees

Labels

breakingThis change will break codebugIndicates an unexpected problem or unintended behaviorhashing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions