https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100051
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to huadong from comment #6) > There are still two questions: > 1. With compilation option "-O2 -fno-strict-aliasing", which disables alias > optimization, the code still has issues with its execution results. > 2. Could you please help identify which specific line of code violates the > aliasing rules? The GCC toolchain did not generate any compilation warnings > regarding this. You are storing an object of size uint32_t via reg_write to an object of size 'char', the variable 'c'. That invokes UB - this isn't about strict aliasing, you are accessing the object 'c' out of bounds. On Linux, 'c' isn't even aligned to 4 bytes, so you are storing to a random location.
