Hi Konstantin, > Indeed it looks like a problem. > Thanks for pointing it out. > Was able to reproduce it with gcc 11 (clang 13 seems fine). > Actually, adding ' __attribute__ ((__may_alias__))' for both dst and src > didn't quire the problem.
__may_alias__ works if it's applied to a typedef, see the following for a modified version of my original example that works and uses __may_alias__: https://godbolt.org/z/W83zzoePq The documentation I found for __may_alias__ is quite sparse, so I'm a little wary of assuming it'll always work. I'm hoping someone with more experience with the attribute would be able to add more confidence to the assumption that it'll work in all cases.