This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR59448 - Promote consume to acquire
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Torvald Riegel <triegel at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, filter-gcc at preshing dot com
- Date: Tue, 13 Jan 2015 15:59:12 +0100
- Subject: Re: [PATCH] PR59448 - Promote consume to acquire
- Authentication-results: sourceware.org; auth=none
- References: <54B53203 dot 6030304 at redhat dot com>
On Tue, Jan 13, 2015 at 3:56 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> Lengthy discussion : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59448
>
> Basically we can generate incorrect code for an atomic consume operation in
> some circumstances. The general feeling seems to be that we should simply
> promote all consume operations to an acquire operation until there is a
> better definition/understanding of the consume model and how GCC can track
> it.
>
> I proposed a simple patch in the PR, and I have not seen or heard of any
> dissenting opinion. We should get this in before the end of stage 3 I
> think.
>
> The problem with the patch in the PR is the memory model is immediately
> promoted from consume to acquire. This happens *before* any of the
> memmodel checks are made. If a consume is illegally specified (such as in a
> compare_exchange), it gets promoted to acquire and the compiler doesn't
> report the error because it never sees the consume.
>
> This new patch simply makes the adjustment after any errors are checked on
> the originally specified model. It bootstraps on x86_64-unknown-linux-gnu
> and passes all regression testing.
> I also built an aarch64 compiler and it appears to issue the LDAR as
> specified in the PR, but anyone with a vested interest really ought to check
> it out with a real build to be sure.
>
> OK for trunk?
Why not patch get_memmodel? (not sure if that catches all cases)
Richard.
>
> Andrew