Hi Luc, > > 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
Interesting, I played with '__may_alias__' attribute a bit more, and yes, as you said, it seems to wok properly only with typedefs. If so, then we probably can add a new typedefs (in rte_common.h or so), and use it in rte_memcpy and probably few other places, where we think it will be necessary. > 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. Agree, would like to see more input too. CC-ing to other guys, who seemed to be interested in that discussion before. Thanks Konstantin