md4c icon indicating copy to clipboard operation
md4c copied to clipboard

Fix alignment issue in md_mark_store_ptr()

Open wmww opened this issue 5 months ago • 2 comments

Fixes #289 by making MD_MARK_tag a union (so the compiler will give it the correct alignment). Since the main member of the union is an anonymous struct, its properties can still be accessed as if they're toplevel MD_MARK_tag properties.

wmww avatar Jul 20 '25 09:07 wmww

Both the store and load are done via memcpy - which works at byte level - and thus there's no alignment issues. Whatever tool you're using is giving false positive warning.

N-R-K avatar Jul 20 '25 17:07 N-R-K

I would expect it to be well defined, I suppose a false positive is a possibility. In any case I think my patch (especially now after edits) makes the code clearer, simpler and shorter as well as making it play nice with Fil-C, so maybe still worth merging.

wmww avatar Jul 21 '25 05:07 wmww