This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFD] Using the 'memory constraint' trick to avoid memory clobber doesn't work
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: David Wohlferd <dw at LimeGreenSocks dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 3 Oct 2014 04:07:36 -0400 (EDT)
- Subject: Re: [RFD] Using the 'memory constraint' trick to avoid memory clobber doesn't work
- Authentication-results: sourceware.org; auth=none
- References: <5422761C dot 2010507 at LimeGreenSocks dot com> <CAFiYyc17coKQ71HcupK5ciabRzzrcTeN2xPJ3zsTPs5BboqSyg at mail dot gmail dot com> <5423C5F2 dot 80509 at samsung dot com> <542541D9 dot 400 at LimeGreenSocks dot com> <CAFiYyc0gqKpCYGi3eLLuo8uPuvN+mDCC7Qr2X0yinNP3AEgedQ at mail dot gmail dot com> <542E4507 dot 7060200 at LimeGreenSocks dot com>
On Thu, 2 Oct 2014, David Wohlferd wrote:
> > You want
> >
> > "=m" (*( struct foo { char x[8]; } __attribute__((may_alias)) *)Dest)
>
> Thank you. With your help, that worse-than-useless sample in the docs
> is getting closer to something people can actually use.
Thank *you* for your investigation.
> While I really like the idea of using memory constraints to avoid all
> out memory clobbers, 16 bytes is a pretty small maximum memory block,
> and x32 only supports a max of 8. Unless there's some way to use larger
> sizes (say SSIZE_MAX), this feature hardly seems worth documenting.
Exactly. Now, with it documented and all, we're (should be) on
the hook to actually maintain that...feature, so we don't break
it now that the tweaked version works. The best practice is a
test-case in the test-suite. With all the required tweaks I
presume we don't have one. It seems grepping a gimple dump
works, with a scan-dump-based test (numerous examples; framework
is in place). Could you please consider adding one?
(Or a patch to remove the feature from the docs since it hasn't
had the intended effect for some long time - my not-so-secret
actual point...)
brgds, H-P