From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42599 invoked by alias); 16 Dec 2018 16:14:07 -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 42579 invoked by uid 89); 16 Dec 2018 16:14:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,SPF_PASS autolearn=ham version=3.3.2 spammy=D*eu, D*dinux.eu, sk:dimitar, dimitar@dinux.eu X-HELO: server28.superhosting.bg Received: from server28.superhosting.bg (HELO server28.superhosting.bg) (217.174.156.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Dec 2018 16:14:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PZ3km7JHnlW8DhGwmGGP2c7QwutD9U5nYvu095qkgx0=; b=aeJYSVvnGWqJDgEC4Vgdpou7hx vjlZgnxuQQnu6Yhn9pwhnnJwL1//xS3gi5IZcir691V8k/KVneU0ZPu6PPsGTAtcxNXHVsU1u2Ehu g+cOBAFtF3Jqmnxr373aRxYZx8rv3JFUkPE7Vpquczqz5XIZu3+sZzECvquL5AQvIaKfl3XNXUidQ QqlGKZNDQimZ+9z/JSDG5wEB5/TDxQF+Sc8o3vIji0cMZf3WB7yz/HpgBGO9D0p4VHeHBsl+mth4C VDlhc7Qq0FKePntgdo96YIDdgmBvjbKFalTcVq/5hlTmyZ3DseJvgX5KHWuJDTLJDRTvRFxtqCWOg jtcPH8zg==; Received: from [95.87.234.74] (port=55304 helo=tpdeb.localnet) by server28.superhosting.bg with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gYZ3G-0002a4-3h; Sun, 16 Dec 2018 18:14:00 +0200 From: Dimitar Dimitrov To: Bernd Edlinger Cc: Segher Boessenkool , Christophe Lyon , Thomas Preudhomme , "gcc-patches@gcc.gnu.org" , Richard Sandiford Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807 Date: Sun, 16 Dec 2018 16:14:00 -0000 Message-ID: <85840089.MtehzfUrTt@tpdeb> User-Agent: KMail/5.2.3 (Linux/4.9.0-8-amd64; KDE/5.28.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart17564597.KZfx3Gk4kg" Content-Transfer-Encoding: 7Bit X-OutGoing-Spam-Status: No, score=-0.5 X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01177.txt.bz2 This is a multi-part message in MIME format. --nextPart17564597.KZfx3Gk4kg Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 612 On Sun, Dec 16 2018 at 14:36:26 EET Bernd Edlinger wrote: > Hi, > > if I understood that right, then clobbering sp is and has always been > ignored. > > If that is right, then I would much prefer a warning, that says exactly > that, because that would also help to understand why removing that clobber > statement is safe even for old gcc versions. > > Since your patch did not actually change the handling of the PIC register, > that one should of course stay an error. Thank you. Looks like general consensus is to have a warning. See attached patch that switches the error to a warning. Regards, Dimitar --nextPart17564597.KZfx3Gk4kg Content-Disposition: attachment; filename="0001-PR-target-52813.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-PR-target-52813.patch" Content-length: 2299 >From d589ebd7824b4505ab75a2404f49a7c200679545 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 16 Dec 2018 10:13:18 +0200 Subject: [PATCH] PR target/52813 Turns out there are existing programs that clobber stack pointer. To avoid disruption, switch the newly introduced error to a warning. Tested with: $ make check-gcc-c RUNTESTFLAGS="i386.exp=pr52813.c " gcc/ChangeLog: 2018-12-16 Dimitar Dimitrov * cfgexpand.c (asm_clobber_reg_is_valid): Switch error to warning. Add clarification why there is a warning. gcc/testsuite/ChangeLog: 2018-12-16 Dimitar Dimitrov * gcc.target/i386/pr52813.c (test1): Update warning message. Signed-off-by: Dimitar Dimitrov --- gcc/cfgexpand.c | 7 +++++-- gcc/testsuite/gcc.target/i386/pr52813.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 0d04bbcafce..1e44c9a7ad0 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2872,10 +2872,13 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname) error ("PIC register clobbered by %qs in %", regname); is_valid = false; } - /* Clobbering the STACK POINTER register is an error. */ + /* Clobbered STACK POINTER register is not saved/restored by GCC, + which is often unexpected by users. See PR52813. */ if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM)) { - error ("Stack Pointer register clobbered by %qs in %", regname); + warning (0, "Stack Pointer register clobbered by %qs in %", + regname); + warning (0, "GCC has always ignored Stack Pointer % clobbers"); is_valid = false; } diff --git a/gcc/testsuite/gcc.target/i386/pr52813.c b/gcc/testsuite/gcc.target/i386/pr52813.c index 154ebbfc423..644fef15fef 100644 --- a/gcc/testsuite/gcc.target/i386/pr52813.c +++ b/gcc/testsuite/gcc.target/i386/pr52813.c @@ -5,5 +5,5 @@ void test1 (void) { - asm volatile ("" : : : "%esp"); /* { dg-error "Stack Pointer register clobbered" } */ + asm volatile ("" : : : "%esp"); /* { dg-warning "Stack Pointer register clobbered.\+GCC has always ignored Stack Pointer 'asm' clobbers" } */ } -- 2.11.0 --nextPart17564597.KZfx3Gk4kg--