From patchwork Wed Jan 20 21:32:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1429457 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=d7uVB+Cg; dkim-atps=neutral Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLdzb3sVmz9sW1 for ; Thu, 21 Jan 2021 08:32:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C812F3854820; Wed, 20 Jan 2021 21:32:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C812F3854820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1611178370; bh=TTIG15tsJbkP+pAn/V5R5zKPPtRfV9njh2krdUkrdfU=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=d7uVB+CgmJTp0SU+kBmaWgVI9j7yFzQDjzcZ0D4f3UpAodR93eiBtVodW/e2wpO5a 4ts0leW1p1VjIlDVqvX634h/s9AJuZzJDGyqVG7P/FpcmldDDkYDeNR+bmWzB3Eot9 E0NHAfjofJDM+2XbEGdLB89zmekLjv4ykjhYScRE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 55987385780F for ; Wed, 20 Jan 2021 21:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 55987385780F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357--96_Ift2MY-KM8QB6LPm2A-1; Wed, 20 Jan 2021 16:32:45 -0500 X-MC-Unique: -96_Ift2MY-KM8QB6LPm2A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB83B802B46; Wed, 20 Jan 2021 21:32:43 +0000 (UTC) Received: from [10.10.118.121] (ovpn-118-121.rdu2.redhat.com [10.10.118.121]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86A4E1000320; Wed, 20 Jan 2021 21:32:43 +0000 (UTC) Subject: [patch] Re: trapv question To: Richard Biener , gcc-patches References: <59cb3869-3edc-fc80-8b00-815d91e0ff1f@redhat.com> <68FBBD02-5BBB-4E9A-B138-C326988F3BA9@gmail.com> Message-ID: Date: Wed, 20 Jan 2021 16:32:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <68FBBD02-5BBB-4E9A-B138-C326988F3BA9@gmail.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" On 1/20/21 1:43 PM, Richard Biener wrote: > On January 20, 2021 6:52:11 PM GMT+01:00, Andrew MacLeod wrote: > >> diff --git a/gcc/testsuite/gcc.dg/torture/ftrapv-2.c >> b/gcc/testsuite/gcc.dg/torture/ftrapv-2.c >> index 75e464fe557..5824c2fdbb7 100644 >> --- a/gcc/testsuite/gcc.dg/torture/ftrapv-2.c >> +++ b/gcc/testsuite/gcc.dg/torture/ftrapv-2.c >> @@ -20,7 +20,7 @@ int main(void) >>    int status = 0; >>    if (child == 0) >>      { >> -      volatile int x = i + 1 < i; >> +      i = i + 1; > But i should then be volatile which should make it LTO proof as well. Otherwise this looks OK. > > Richard. > > >>        exit (0); >>      } >>    else if (child == -1) >> >> >> Is that the right thing to do? >> >> THanks >> Andrew Done... pushed commit 842afc4e289ed3fe69583672c1a180f268d73799 Author: Andrew MacLeod Date: Wed Jan 20 16:27:34 2021 -0500 Re: trapv question Adjust testcase to so the ADD that is expected to overflow cannot be optimized. gcc/testsuite * gcc.dg/torture/ftrapv-2.c: Make overflow instruction unremovable. diff --git a/gcc/testsuite/gcc.dg/torture/ftrapv-2.c b/gcc/testsuite/gcc.dg/torture/ftrapv-2.c index 75e464fe557..4d746c9ce5c 100644 --- a/gcc/testsuite/gcc.dg/torture/ftrapv-2.c +++ b/gcc/testsuite/gcc.dg/torture/ftrapv-2.c @@ -12,7 +12,7 @@ /* Verify SImode operations properly trap. PR middle-end/68046 */ -int i = 0x7fffffff; +volatile int i = 0x7fffffff; int main(void) { @@ -20,7 +20,7 @@ int main(void) int status = 0; if (child == 0) { - volatile int x = i + 1 < i; + i = i + 1; exit (0); } else if (child == -1)