From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4621 invoked by alias); 16 Sep 2014 22:25:50 -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 4610 invoked by uid 89); 16 Sep 2014 22:25:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: mail-lb0-f172.google.com Received: from mail-lb0-f172.google.com (HELO mail-lb0-f172.google.com) (209.85.217.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 16 Sep 2014 22:25:48 +0000 Received: by mail-lb0-f172.google.com with SMTP id w7so717033lbi.17 for ; Tue, 16 Sep 2014 15:25:45 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.170.167 with SMTP id an7mr14757589lac.94.1410906345106; Tue, 16 Sep 2014 15:25:45 -0700 (PDT) Received: by 10.25.145.80 with HTTP; Tue, 16 Sep 2014 15:25:45 -0700 (PDT) In-Reply-To: <20140916220344.GA31613@arm.com> References: <20140904081855.GA18028@arm.com> <20140916220344.GA31613@arm.com> Date: Tue, 16 Sep 2014 22:25:00 -0000 Message-ID: Subject: Re: [PATCH v2 AArch64]: Re: [PATCH AArch64]: Add constraint letter for stack_protect_test pattern. From: Andrew Pinski To: James Greenhalgh Cc: Venkataramanan Kumar , Marcus Shawcroft , "gcc-patches@gcc.gnu.org" , Patch Tracking , Richard Earnshaw , Matthias Klose , Steve McIntyre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg01327.txt.bz2 On Tue, Sep 16, 2014 at 3:03 PM, James Greenhalgh wrote: > On Tue, Sep 16, 2014 at 10:36:08PM +0100, Andrew Pinski wrote: >> On Thu, Sep 4, 2014 at 1:18 AM, James Greenhalgh >> wrote: >> > On Thu, Sep 04, 2014 at 08:42:31AM +0100, Venkataramanan Kumar wrote: >> >> Hi maintainers, >> >> >> >> I just added "=3Dr" and retested it. >> > >> > I had a very similar patch to this sitting in my local tree. However, >> > I am surprised you have left operand 3 as an output operand. In my tree >> > I had marked operand 3 as "&r". >> > >> > What do you think? >> >> The clobber needs to be "=3D&r" as you are writing to the register and >> not just reading from it. I think this is causing some issues >> including linaro bugzilla #667 >> (https://bugs.linaro.org/show_bug.cgi?id=3D667). > > (+CC Matthias Klose and Steve McIntyre who have also been in contact with= me > regarding this bug) > > I've seen this bug locally, and had considered sending the patch you > suggested, which does indeed fix the bug. However, it feels wrong as > the operand is not a formal output of the pattern. It is clobbered - and > indeed earlyclobbered - so yes it is written to, but it isn't an output. > This makes the fix look like a band-aid around the real problem. > > The bug looks similar to pr52573 - regrename fails to spot that it should > not rename to a register used in an earlyclobber operand of any type, rat= her > than just an output+earlyclobber operand as it does now. > > I've played about with a fix that sits in regrename, and forces it to thi= nk > of all earlyclobber operands as starting and ending chains but this didn't > bootstrap clean - we end up with what I believe are false reports of stack > smashing in libstdc++. > > I was planning to look again at my approach tomorrow, I would like to > convince myself that this isn't a deficiency in regrename before I would > support just marking this operand "=3D&r". > > If you have any other suggestions, or if "=3D&r" is actually correct and > I am misreading the documentation please let me know. I think you misread the documentation. Or rather the documentation is not fully clear here. https://gcc.gnu.org/onlinedocs/gccint/Modifiers.html says this for "&": =E2=80=98&=E2=80=99 does not obviate the need to write =E2=80=98=3D=E2=80= =99 or =E2=80=98+=E2=80=99. Which means you need "=3D" if you write to the register. Match_scratch is the same as match_operand except it is able to be added back during combine. Also "=3D" means: Means that this operand is write-only for this instruction: the previous value is discarded and replaced by output data. That is not necessary a formal output of the pattern. Thanks, Andrew Thanks, Andrew Pinski > > Thanks, > James >