Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

GCC -O2 -Wstrict-aliasing=2 warnings #66

Closed
avbe opened this issue Apr 13, 2020 · 1 comment
Closed

GCC -O2 -Wstrict-aliasing=2 warnings #66

avbe opened this issue Apr 13, 2020 · 1 comment
Assignees
Labels
quality quality improvement

Comments

@avbe
Copy link

avbe commented Apr 13, 2020

GCC reports strict aliasing issues with -O2 (or higher optimization level) and -Wstrict-aliasing=2

robin_hood.h:2176:47: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
robin_hood.h:2160:50: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

These are probably false positives, which can be treated with

#pragma GCC diagnostic ignored "-Wstrict-aliasing"

or using less questionable pointer types conversion.

Reproduced with gcc versions 6.3.0 and 8.3.0.

@avbe avbe changed the title GCC -O3 -Wstrict-aliasing=2 warnings GCC -O2 -Wstrict-aliasing=2 warnings Apr 13, 2020
@martinus martinus self-assigned this Apr 14, 2020
@martinus martinus added the quality quality improvement label Apr 14, 2020
@martinus
Copy link
Owner

Thanks, fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
quality quality improvement
Projects
None yet
Development

No branches or pull requests

2 participants