laf icon indicating copy to clipboard operation
laf copied to clipboard

Fix strict-alias warnings

Open winterheart opened this issue 10 months ago • 2 comments

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 https://github.com/aseprite/aseprite/issues/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

winterheart avatar Apr 14 '24 19:04 winterheart

clang-tidy review says "All clean, LGTM! :+1:"

aseprite-bot avatar Apr 14 '24 19:04 aseprite-bot

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 avatar May 08 '24 12:05 dacap