https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114217
--- Comment #3 from Akihiko Odaki <akihiko.odaki at daynix dot com> --- (In reply to Andrew Pinski from comment #1) > >but also emits code to assert alignment. > > > Yes because the code is broken still. > > The alignment is not about when the access happens but rather when the > pointer is casted to. > > So in this case when passing in the argument to f, the argument entry should > be aligned to what the `struct dir_entry` is aligned to; otherwise it is > undefined code. I had a similar thought when I faced the same issue before and didn't report it then, but this time I realized GCC still emits code to perform slow unaligned access for such a construct. Whichever is right, to assume an aligned or unaligned access, it is not consistent. Theoretically, it also makes sense to emit unaligned memory access for such a construct instead of ignoring it when -fsanitize=address, but I'm worried that such a change will break too many things.