From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8909 invoked by alias); 13 Jan 2015 14:59:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 8898 invoked by uid 89); 13 Jan 2015 14:59:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f179.google.com Received: from mail-ob0-f179.google.com (HELO mail-ob0-f179.google.com) (209.85.214.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Jan 2015 14:59:14 +0000 Received: by mail-ob0-f179.google.com with SMTP id nt9so2836893obb.10 for ; Tue, 13 Jan 2015 06:59:12 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.61.9 with SMTP id k9mr20113887oia.116.1421161152256; Tue, 13 Jan 2015 06:59:12 -0800 (PST) Received: by 10.76.58.167 with HTTP; Tue, 13 Jan 2015 06:59:12 -0800 (PST) In-Reply-To: <54B53203.6030304@redhat.com> References: <54B53203.6030304@redhat.com> Date: Tue, 13 Jan 2015 15:11:00 -0000 Message-ID: Subject: Re: [PATCH] PR59448 - Promote consume to acquire From: Richard Biener To: Andrew MacLeod Cc: gcc-patches , Jeff Law , Torvald Riegel , "Joseph S. Myers" , filter-gcc@preshing.com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00846.txt.bz2 On Tue, Jan 13, 2015 at 3:56 PM, Andrew MacLeod 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