Skip to content

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

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