From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110008 invoked by alias); 3 Dec 2018 16:26:03 -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 109987 invoked by uid 89); 3 Dec 2018 16:26:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=PR64242, pr64242, THanks, builtins.c 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; Mon, 03 Dec 2018 16:26:00 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DFE330DE03D; Mon, 3 Dec 2018 16:25:59 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF9755B6BC; Mon, 3 Dec 2018 16:25:58 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wB3GPuq3017076; Mon, 3 Dec 2018 17:25:56 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wB3GPsOD017075; Mon, 3 Dec 2018 17:25:54 +0100 Date: Mon, 03 Dec 2018 16:26:00 -0000 From: Jakub Jelinek To: Jeff Law Cc: Wilco Dijkstra , GCC Patches , nd Subject: Re: [PATCH] Fix PR64242 Message-ID: <20181203162554.GZ12380@tucnak> Reply-To: Jakub Jelinek References: <8d85508a-f679-54fb-af20-4f267b813df0@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d85508a-f679-54fb-af20-4f267b813df0@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00102.txt.bz2 Hi! Here is a fix for the testcase, so that it doesn't FAIL pretty much everywhere. On Fri, Nov 30, 2018 at 04:07:31PM -0700, Jeff Law wrote: > > PR middle-end/64242 > > * gcc.c-torture/execute/pr64242.c: New test. > THanks for tracking this down. I'd like to have this run through my > next testing cycle, so I went ahead and installed it for you. What I've tested: 1) x86_64-linux {-m32,-m64} - without the testcase patch, the testcase FAILs without or with the builtins.c change; with the testcase patch and witout the builtins.c change, there is FAIL: gcc.c-torture/execute/pr64242.c -O2 execution test FAIL: gcc.c-torture/execute/pr64242.c -O3 -g execution test FAIL: gcc.c-torture/execute/pr64242.c -Os execution test for -m32 and no FAILs for -m64, with the builtins.c change the tests passes on both -m32 and -m64 2) powerpc64-linux {-m32,-m64} - without the testcase patch, the testcase FAILs without and with the builtins.c change for -m32. With the testcase patch and without the builtins.c change, there is FAIL: gcc.c-torture/execute/pr64242.c -O0 execution test FAIL: gcc.c-torture/execute/pr64242.c -O1 execution test FAIL: gcc.c-torture/execute/pr64242.c -O2 execution test FAIL: gcc.c-torture/execute/pr64242.c -O3 -g execution test FAIL: gcc.c-torture/execute/pr64242.c -Os execution test for -m32 and FAIL: gcc.c-torture/execute/pr64242.c -O0 execution test FAIL: gcc.c-torture/execute/pr64242.c -O1 execution test for -m64, with the builtins.c change everything passes 3) aarch64-linux - both without and with the testcase patch, the testcase FAILs without the builtins.c change and passes with it Ok for trunk? 2018-12-03 Jakub Jelinek PR middle-end/64242 * gcc.c-torture/execute/pr64242.c (foo, bar): New functions. (p): Make it void *volatile instead of volatile void *. (q): New variable. (main): Add a dummy 32-byte aligned variable and escape its address. Don't require that the two __builtin_alloca (0) calls return the same address, just require that their difference is smaller than 1024 bytes. --- gcc/testsuite/gcc.c-torture/execute/pr64242.c.jj 2018-12-01 00:25:08.082009500 +0100 +++ gcc/testsuite/gcc.c-torture/execute/pr64242.c 2018-12-03 16:51:51.869797742 +0100 @@ -3,7 +3,7 @@ extern void abort (void); __attribute ((noinline)) void -broken_longjmp(void *p) +broken_longjmp (void *p) { void *buf[5]; __builtin_memcpy (buf, p, 5 * sizeof (void*)); @@ -11,20 +11,41 @@ broken_longjmp(void *p) __builtin_longjmp (buf, 1); } +__attribute ((noipa)) __UINTPTR_TYPE__ +foo (void *p) +{ + return (__UINTPTR_TYPE__) p; +} + +__attribute ((noipa)) void +bar (void *p) +{ + asm volatile ("" : : "r" (p)); +} + volatile int x = 0; -volatile void *p; +void *volatile p; +void *volatile q; + int -main (void) +main () { void *buf[5]; + struct __attribute__((aligned (32))) S { int a[4]; } s; + bar (&s); p = __builtin_alloca (x); - if (!__builtin_setjmp (buf)) broken_longjmp (buf); /* Fails if stack pointer corrupted. */ - if (p != __builtin_alloca (x)) - abort(); + q = __builtin_alloca (x); + if (foo (p) < foo (q)) + { + if (foo (q) - foo (p) >= 1024) + abort (); + } + else if (foo (p) - foo (q) >= 1024) + abort (); return 0; } Jakub