From patchwork Thu Jan 16 18:21:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 311815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0464B2C007C for ; Fri, 17 Jan 2014 05:21:55 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=xr5czxnSARuOb5bfx H2HAia+3Py1woZt60oaBSTpkU1tg4+ug4tWel1imaBXVsXc3+BjSTOylChtPKVM3 Q2BGduMsBbjh+5WEKnY5jYuqRc2rbJy7BPBeILVZpXmEuOJJg8xCAwkufZ6PeGGo 3la7wzs/5OfqvR/y0SuquTNQ90= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=BMoCMzdVQ5wSX5FlC2WPAVa ycEI=; b=TbSH3o7uKzP1R8XYEsjWmg7hLydcwGRfE7lTK5Cdn478f5k1oV4TRke 41MniWjIPUrR6yHiD9ab41zzN3kn+tQK5HOsIcbdgewh4KNzZBeQakvwR0m/BjNR iw+NOqfRaZJQQ/kFYk4IPAR7tTBBb1j0BneLiE6v06QdPb+Cu+n4= Received: (qmail 12944 invoked by alias); 16 Jan 2014 18:21:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 12933 invoked by uid 89); 16 Jan 2014 18:21:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2014 18:21:46 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0GILjvK001516 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Jan 2014 13:21:45 -0500 Received: from tucnak.zalov.cz (vpn1-4-28.ams2.redhat.com [10.36.4.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0GILhN0024070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jan 2014 13:21:44 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id s0GILghI028292; Thu, 16 Jan 2014 19:21:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id s0GILg2J028291; Thu, 16 Jan 2014 19:21:42 +0100 Date: Thu, 16 Jan 2014 19:21:42 +0100 From: Jakub Jelinek To: Richard Henderson Cc: "H.J. Lu" , GCC Patches Subject: Re: [PATCH] Diagnose pr54694 Message-ID: <20140116182142.GT892@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <52D6B611.6040802@redhat.com> <52D700F6.2060609@redhat.com> <20140115215845.GH892@tucnak.redhat.com> <52D8036F.5020904@redhat.com> <20140116173545.GQ892@tucnak.redhat.com> <52D81C1C.6040402@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <52D81C1C.6040402@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On Thu, Jan 16, 2014 at 09:51:24AM -0800, Richard Henderson wrote: > On 01/16/2014 09:35 AM, Jakub Jelinek wrote: > > Wonder if the test should be turned into dg-do compile, > > or perhaps a hack like: > > int xmain() __asm__ ("main"); > > int xmain() > > instead of > > int main() > > to avoid the dynamic stack realigning in main (limit the test to *linux* > > then?), supply main written in assembly, something else? > > > The __asm__ hack seems reasonable, although you'll also have to deal > with __USER_LABEL_PREFIX__. So like this? Tested on x86_64 with make -k check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} i386.exp=pr9771-1.c' 2014-01-16 Jakub Jelinek PR debug/54694 * gcc.target/i386/pr9771-1.c (main): Rename to... (real_main): ... this. Add __asm name "main". (ASMNAME, ASMNAME2, STRING): Define. Jakub --- gcc/testsuite/gcc.target/i386/pr9771-1.c.jj 2013-08-13 12:20:13.000000000 +0200 +++ gcc/testsuite/gcc.target/i386/pr9771-1.c 2014-01-16 19:17:24.807903910 +0100 @@ -45,7 +45,17 @@ void test(void) exit(0); } -int main() +/* main usually performs dynamic realignment of the stack in case + _start would fail to properly align the stack, but for dynamic + stack realignment we need frame pointer which is incompatible + with -ffixed-ebp and the global register var. So, cheat here + and hide from the compiler that main is really main. */ +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x +int real_main() __asm (ASMNAME ("main")); + +int real_main() { test(); return 0;