From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104903 invoked by alias); 1 Jun 2017 08:30:38 -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 104735 invoked by uid 89); 1 Jun 2017 08:30:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:sk:mailhos, Hx-languages-length:953, H*RU:sk:mailhos, H*M:internal X-HELO: smtprelay.synopsys.com Received: from us01smtprelay-2.synopsys.com (HELO smtprelay.synopsys.com) (198.182.60.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Jun 2017 08:30:19 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 2404310C0B2A; Thu, 1 Jun 2017 01:30:14 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 1524DD95; Thu, 1 Jun 2017 01:30:14 -0700 (PDT) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id D6382D86; Thu, 1 Jun 2017 01:30:13 -0700 (PDT) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.266.1; Thu, 1 Jun 2017 01:30:13 -0700 Received: from DE02WEMBXA.internal.synopsys.com ([fe80::a014:7216:77d:d55c]) by DE02WEHTCB.internal.synopsys.com ([::1]) with mapi id 14.03.0266.001; Thu, 1 Jun 2017 10:30:12 +0200 From: Claudiu Zissulescu To: Andrew Burgess CC: "gcc-patches@gcc.gnu.org" , "Francois.Bedard@synopsys.com" Subject: RE: [PATCH 6/7] [ARC] Prevent moving stores to the frame before the stack adjustment. Date: Thu, 01 Jun 2017 08:30:00 -0000 Message-ID: <098ECE41A0A6114BB2A07F1EC238DE896662C36F@de02wembxa.internal.synopsys.com> References: <1495189862-20533-1-git-send-email-claziss@synopsys.com> <1495189862-20533-7-git-send-email-claziss@synopsys.com> <20170531163313.GI25719@embecosm.com> In-Reply-To: <20170531163313.GI25719@embecosm.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2017-06/txt/msg00009.txt.bz2 > Given the description the code looks fine. It would be nice to see > more of a _why_ in the commit message. I'm guessing this is either > something related to signal handling, or debugging... I don't see why > this would be needed for functional correctness. >=20 The issue is how we generate a function prologue when we use fno-omit-frame= -pointer, for example: [snip] mov_s fp,sp ; frame pointer is set here [snip] st r1,[fp,-24] ; frame pointer is used here [snip] sub_s sp,sp,0x20 ; stack pointer adjusted So we can easily see that any interrupt between the `st` and `sub` instruct= ion will lead to faulty code as the interrupt routine will use a faulty sp = register, and, potentially, overwriting the value stored by 'st' instructio= n. Thus, adding a scheduler barrier will force the compiler to emit the `su= b` instruction before the store one. Thanks, Claudiu