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 strict-alias warnings #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

winterheart
Copy link
Contributor

reinterpret_cast on pointers break strict-aliasing rule (-Wstrict-aliasing). Implemented internal function copy_reinterpret_cast that memcpy pointer into type, that can be converted to desired type.

Closes aseprite/aseprite#4413

I agree that my contributions are licensed under the MIT License.
You can find a copy of this license at https://opensource.org/licenses/MIT

reinterpret_cast on pointers break strict-aliasing rule (-Wstrict-aliasing). Implemented internal function copy_reinterpret_cast that memcpy pointer into type, that can be converted to desired type.
@aseprite-bot
Copy link
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap
Copy link
Member

dacap commented May 8, 2024

Thanks @winterheart, I've just tested and this change segfaults one of our userdata_codec.lua tests where these functions are used:

Testing scripts...
Running scripts/userdata_codec.lua
run-tests.sh: line 69:  1690 Segmentation fault      $ASEPRITE -b --script $script > $t/tmp 2>&1

image

@dacap dacap removed their assignment May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails with strict-aliasing violations
3 participants