mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: un-UBify-strings
Date: Sat, 22 Sep 2018 22:32:34 -0400	[thread overview]
Message-ID: <20180923023234.GE17995@brightrain.aerifal.cx> (raw)
In-Reply-To: <A2638F6B-B7FB-48E2-92CD-CE492C41B971@trust-in-soft.com>

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@libc.org<mailto:dalias@libc.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


  reply	other threads:[~2018-09-23  2:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23  0:35 un-UBify-strings Rich Felker
2018-09-23  2:11 ` un-UBify-strings Pascal Cuoq
2018-09-23  2:32   ` Rich Felker [this message]
2018-09-23  2:45     ` un-UBify-strings Rich Felker
2018-09-23  3:10       ` un-UBify-strings Pascal Cuoq
2018-09-23  3:15         ` un-UBify-strings Rich Felker
2018-09-23  3:44           ` un-UBify-strings Pascal Cuoq
2018-09-23  4:02             ` un-UBify-strings Rich Felker
2018-09-23  3:45           ` un-UBify-strings Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180923023234.GE17995@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).