From patchwork Sat Jun 7 00:04:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 357036 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 3D8C114008B for ; Sat, 7 Jun 2014 10:04:43 +1000 (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:subject:message-id:mime-version:content-type; q=dns; s= default; b=sy17T1HsPF6YKcxpLUS/hnl+WUy0zgD+k+zbftsTHTLehUtDKMLCj DIP8XbYzQi9NbE9QMzpV12pGpoEZ10JamenBuxfjBgAIi2ayxTjGf2q2aCVUNjfA IVHtm+W3yyYsEn6Lt7jjFpxP4wnlgRaLBXiQy3fVFgom0Q9Q9qZ10M= 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:subject:message-id:mime-version:content-type; s= default; bh=rr0KEtGk4ERdFKFvCJ3u32/NEHM=; b=k/a1rJdEiDpxwUX16J8W rh5MiiRctHMKLvDvN16AWr+6zKU/L9zgBrE0+jPPXFlbZnLpti1/e+Ee7plVRrOH vfF9ysfWXIIvIEuiR7gVbVM1Ny78rVDM2pdh5X7JC4/xupM1nbnVzxls27cG/YaS iC4HeoXH1YKT5i6odghqU+Q= Received: (qmail 21066 invoked by alias); 7 Jun 2014 00:04:36 -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 21053 invoked by uid 89); 7 Jun 2014 00:04:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: arjuna.pair.com Received: from arjuna.pair.com (HELO arjuna.pair.com) (209.68.5.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Sat, 07 Jun 2014 00:04:33 +0000 Received: (qmail 14072 invoked by uid 3006); 7 Jun 2014 00:04:31 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 7 Jun 2014 00:04:31 -0000 Date: Fri, 6 Jun 2014 20:04:31 -0400 (EDT) From: Hans-Peter Nilsson To: gcc-patches@gcc.gnu.org Subject: Committed: fix MMIX LTO gcc.dg/torture/stackalign/builtin-return-1.c Message-ID: User-Agent: Alpine 2.02 (BSF 1266 2009-07-14) MIME-Version: 1.0 X-IsSubscribed: yes Apparently LTO improved or at least changed between r210000 and r211121, such that memory outside the defined space was wrongly read as "expected" for this test-case, corresponding to the wrongly presumed stacked parameters. For a "normal" target this would correspond to a SEGV. You'd need the memory-strictness change file (a sort-of CWEB patch) from to see this when testing with the mmixware mmix simulator: Running /home/hp/gcctop/tmp/mbase1/gcc/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp ... FAIL: gcc.dg/torture/stackalign/builtin-return-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test and in gcc.log: spawn mmix ./builtin-return-1.exe 1. 00000000000003ec: 8d10fd20 (LDOI) $16=l[25] = M8[#16809fffffffffe0+32] = 0 198 instructions, 49 mems, 236 oops; 4 good guesses, 7 bad (now at location #00000000000003f0) (for the default Knuth ABI; but the error for the GNU ABI is similar) This also annotates as fixed an age-old PR, though test has actually been passing for some time after "Tue Nov 9 00:36:20 UTC 2004" (yes, this was CVS time) and up-to-and-including at least r210000. I wrote this fix when investigating fallout from the memory-strictness feature mentioned above, but as this test didn't fail at that time, I didn't apply it. Committed. PR target/18343 * gcc.dg/torture/stackalign/builtin-return-1.c (STACK_ARGUMENTS_SIZE): New macro, 0 for __MMIX__, default 64. (bar): Pass it to __builtin_apply instead of literal 64. brgds, H-P Index: gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c =================================================================== --- gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c (revision 211328) +++ gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c (working copy) @@ -5,6 +5,13 @@ /* This used to fail on SPARC because the (undefined) return value of 'bar' was overwriting that of 'foo'. */ +#ifdef __MMIX__ +/* No parameters on stack for bar. */ +#define STACK_ARGUMENTS_SIZE 0 +#else +#define STACK_ARGUMENTS_SIZE 64 +#endif + extern void abort(void); int foo(int n) @@ -14,7 +21,8 @@ int foo(int n) int bar(int n) { - __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64)); + __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), + STACK_ARGUMENTS_SIZE)); } char *g;