From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74260 invoked by alias); 14 Oct 2017 08:45:35 -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 73981 invoked by uid 89); 14 Oct 2017 08:45:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1011, 14th 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; Sat, 14 Oct 2017 08:45:03 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D5FAC0587CB for ; Sat, 14 Oct 2017 08:45:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0D5FAC0587CB Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub@redhat.com Received: from tucnak.zalov.cz (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9DB06C515 for ; Sat, 14 Oct 2017 08:45:01 +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 v9E8iuf5004326 for ; Sat, 14 Oct 2017 10:44:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v9E8it9q004325 for gcc-patches@gcc.gnu.org; Sat, 14 Oct 2017 10:44:55 +0200 Date: Sat, 14 Oct 2017 09:36:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix pr81423.c testcase (PR rtl-optimization/81423) Message-ID: <20171014084455.GN14653@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00929.txt.bz2 Hi! The original C++ testcase has been transcribed into C and during that process a UB has been introduced, original had unsigned(5677365550390624949LL - ll) - (ull1 > 0) while what has been committed has (5677365550390624949L - ll) - (ull1 > 0) I've also changed all L suffixed constants to LL for consistency with ilp32 (the testcase has been written for x86_64 lp64 apparently) and added better check that int is 32-bit and long long 64-bit. Tested on x86_64-linux and i686-linux and verified that using Jul 14th cc1 still fails on lp64, committed to trunk as obvious. 2017-10-14 Jakub Jelinek PR rtl-optimization/81423 * gcc.c-torture/execute/pr81423.c (foo): Add missing cast. Change L suffixes to LL. (main): Punt if either long long isn't 64-bit or int isn't 32-bit. --- gcc/testsuite/gcc.c-torture/execute/pr81423.c.jj 2017-09-01 09:26:12.000000000 +0200 +++ gcc/testsuite/gcc.c-torture/execute/pr81423.c 2017-10-14 10:31:25.000050882 +0200 @@ -1,3 +1,5 @@ +/* PR rtl-optimization/81423 */ + extern void abort (void); unsigned long long int ll = 0; @@ -10,11 +12,11 @@ foo (void) { ll = -5597998501375493990LL; - ll = (5677365550390624949L - ll) - (ull1 > 0); + ll = (unsigned int) (5677365550390624949LL - ll) - (ull1 > 0); unsigned long long int ull3; ull3 = (unsigned int) - (2067854353L << - (((ll + -2129105131L) ^ 10280750144413668236ULL) - + (2067854353LL << + (((ll + -2129105131LL) ^ 10280750144413668236ULL) - 10280750143997242009ULL)) >> ((2873442921854271231ULL | ull2) - 12098357307243495419ULL); @@ -24,9 +26,10 @@ foo (void) int main (void) { - /* We need a long long of exactly 64 bits for this test. */ - ll--; - if (ll != 0xffffffffffffffffULL) + /* We need a long long of exactly 64 bits and int of exactly 32 bits + for this test. */ + if (__SIZEOF_LONG_LONG__ * __CHAR_BIT__ != 64 + || __SIZEOF_INT__ * __CHAR_BIT__ != 32) return 0; ull3 = foo (); Jakub