Date: Sat, 22 Sep 2018 22:32:34 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: un-UBify-strings On Sun, Sep 23, 2018 at 02:11:42AM +0000, Pascal Cuoq wrote: > Hello Rich, > > On 23 Sep 2018, at 02:35, Rich Felker <dalias@...c.org<mailto:dalias@...c.org>> wrote: > > I've had this patch sitting around since 2016, and just updated it to > apply cleanly. Any objections? > > Your patch contains: > > .... > size_t __attribute__((__may_alias__)) *wd; > const size_t __attribute__((__may_alias__)) *ws; > .... > > In my experience, this use of __may_alias__ does not do anything. > See function f in the example below, which both GCC and Clang > optimize as if the programmer had not used __may_alias__ at all: > https://gcc.godbolt.org/z/Um4NU7 > > You should use a typdef for the aliasing type, as shown for function > g (in with GCC and Clang do not apply the optimization). > > The example in GCC's documentation for __may_alias__ also uses a > typedef: > https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Type-Attributes.html Thanks, this is very helpful. I'll prepare an updated version. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.