From patchwork Sat Dec 13 01:53:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Mansfield X-Patchwork-Id: 420740 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 776001400D5 for ; Sat, 13 Dec 2014 12:54:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=iMQT0EzRHZRMmCiG8 dmfqnYTgIW05tcctUNmu9FhX6qs5eyDBAYk53qgAmQEFgjUly9Ud4iXqXWeaXRfa 6fOMfHAAM7xipEBBojBl5IlVHR67Kl5aWpTmK9SzOGLxy0tDVB6OkCxy2rOUPzoS NuWrV7BAlKVwp+8+dnEqlAWnUA= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=NGlbID8BIKk65PEHER8A//H 4v3w=; b=IRKdU8Ndh7akQijn5ZU90XGL1Q/MkE7H01LuJPNdg+sgWAS//Dg/5aV kaxLDwvlzq91hrilr4DdACpUla/ThTWZh2EG6X1wRiXnMr6AX9xwMvyuput8fJ5O 2g+RbbxmhnKKNyCw/Ew0a+q86/bl1DfC0MiP4HM0AFceY7wdFtsg= Received: (qmail 19103 invoked by alias); 13 Dec 2014 01:54:02 -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 18929 invoked by uid 89); 13 Dec 2014 01:53:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: MXA.qnx.com Received: from mxa.qnx.com (HELO MXA.qnx.com) (72.1.200.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 13 Dec 2014 01:53:57 +0000 X-ASG-Debug-ID: 1418435634-0721887b57a51b0001-Gfy7bY Received: from exhts.ott.qnx.com (exch2.ott.qnx.com [10.222.2.136]) by MXA.qnx.com with ESMTP id zXmBEUZ0ypVQbi0F (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Fri, 12 Dec 2014 20:53:54 -0500 (EST) X-Barracuda-Envelope-From: RMansfield@qnx.com Received: from [10.222.44.198] (10.222.2.5) by EXCH2.ott.qnx.com (10.222.2.136) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 12 Dec 2014 20:53:54 -0500 Message-ID: <548B9C31.6060500@qnx.com> Date: Fri, 12 Dec 2014 20:53:53 -0500 From: Ryan Mansfield User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mike Stump CC: Subject: Re: [Patch][testsuite] Fix a few test cases References: <548B441D.6000101@qnx.com> <437E9961-B789-469A-B675-72533A33D1BD@comcast.net> X-ASG-Orig-Subj: Re: [Patch][testsuite] Fix a few test cases In-Reply-To: <437E9961-B789-469A-B675-72533A33D1BD@comcast.net> X-Barracuda-Connect: exch2.ott.qnx.com[10.222.2.136] X-Barracuda-Start-Time: 1418435634 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://qnx-spam.ott.qnx.com:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.12827 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-IsSubscribed: yes On 14-12-12 04:29 PM, Mike Stump wrote: > On Dec 12, 2014, at 11:38 AM, Ryan Mansfield wrote: >> >> Here are a few test tweaks. In 921202-1.c, if STACK_SIZE is used then VLEN will blow the stack with 64bit longs. e.g. if STACK_SIZE == 512K then 3 arrays of 32767 longs means at a minimum 767K of stack will be used at -O0. In pr51447.c, the rbx global register is clobbering the rbx of main's caller, which can cause test case crashes on return. >> >> 2014-12-12 Ryan Mansfield >> >> * gcc.c-torture/execute/921202-1.c: Adjust VLEN. >> * gcc.c-torture/execute/pr51447.c: Restore rbx for x86-64. >> * gcc.dg/cpp/trad/include.c: Exclude QNX targets. >> >> OK? > > Ok for first and third part. The second one, I would like an rbx/x86_64 person to review. Thanks. rbx is callee saved, and it's being clobbered. e.g. on Linux x86-64 Breakpoint 1, main () at /home/ryan/gnu/gcc/trunk/gcc/testsuite/gcc.c-torture/execute/pr51447.c:13 13 { 1: x/i $pc => 0x40054e
: push %rbp (gdb) info reg rbx rbx 0x0 0 (gdb) s 26 return 0; 1: x/i $pc => 0x400596 : mov $0x0,%eax (gdb) info reg rbx rbx 0x400586 4195718r The global register var docs say: "A function that can alter the value of a global register variable cannot safely be called from a function compiled without this variable, because it could clobber the value the caller expects to find there on return. Therefore, the function that is the entry point into the part of the program that uses the global register variable must explicitly save and restore the value that belongs to its caller." The updated diff switches the test to use inline asm to save/restore rbx instead of the local reg vars, but maybe there's a better way. Regards, Ryan Mansfield Index: gcc/testsuite/gcc.c-torture/execute/921202-1.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/921202-1.c (revision 218685) +++ gcc/testsuite/gcc.c-torture/execute/921202-1.c (working copy) @@ -2,7 +2,7 @@ #ifndef STACK_SIZE #define VLEN 2055 #else -#define VLEN ((STACK_SIZE/16) - 1) +#define VLEN ((STACK_SIZE/32) - 1) #endif main () { Index: gcc/testsuite/gcc.c-torture/execute/pr51447.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr51447.c (revision 218685) +++ gcc/testsuite/gcc.c-torture/execute/pr51447.c (working copy) @@ -14,6 +14,10 @@ main (void) { __label__ nonlocal_lab; +#ifdef __x86_64__ + void *saved_rbx; + asm volatile ("movq %%rbx, %0" : "=r" (saved_rbx) : : ); +#endif __attribute__((noinline, noclone)) void bar (void *func) { @@ -21,9 +25,15 @@ goto nonlocal_lab; } bar (&&nonlocal_lab); +#ifdef __x86_64__ + asm volatile ("movq %0, %%rbx" : : "r" (saved_rbx) : "rbx" ); +#endif return 1; nonlocal_lab: if (ptr != &&nonlocal_lab) abort (); +#ifdef __x86_64__ + asm volatile ("movq %0, %%rbx" : : "r" (saved_rbx) : "rbx" ); +#endif return 0; } Index: gcc/testsuite/gcc.dg/cpp/trad/include.c =================================================================== --- gcc/testsuite/gcc.dg/cpp/trad/include.c (revision 218685) +++ gcc/testsuite/gcc.dg/cpp/trad/include.c (working copy) @@ -1,11 +1,11 @@ /* Copyright (c) 2002 Free Software Foundation Inc. */ -/* Test that macros are not expanded in the <> quotes of #inlcude. */ +/* Test that macros are not expanded in the <> quotes of #include. */ /* vxWorksCommon.h uses the "#" operator to construct the name of an include file, thus making the file incompatible with -traditional-cpp. Newlib uses ## when including stdlib.h as of 2007-09-07. */ -/* { dg-do preprocess { target { { ! vxworks_kernel } && { ! newlib } } } } */ +/* { dg-do preprocess { target { { ! vxworks_kernel } && { ! newlib } && { ! *-*-qnx* } } } } */ #define __STDC__ 1 /* Stop complaints about non-ISO compilers. */ #define stdlib 1