From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 438A93858024 for ; Fri, 14 Oct 2022 14:30:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 438A93858024 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665757856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bjQK2X7r0d74JLw7bHwD0gzx6tXUMsBME3U8p788Esw=; b=ZLYaQsi1l1bntVZLIXzCcilHGrdi50h7AsszeZ4QHBDJv0aFx7BkJHMq2nTfTmGaGyW9vt rfooug/wvuxYcmIZ2zCI2g836QWvy35XxWM0NFuQidKiyDx+r1xfxkj0VQR7QJ/xCJyNkH zhNo7vffkWNlq4QeZz/r5lRLQ1Ll/X4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-247-sGUfhStbOemC5dEcphUQlQ-1; Fri, 14 Oct 2022 10:30:53 -0400 X-MC-Unique: sGUfhStbOemC5dEcphUQlQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C6E00886461 for ; Fri, 14 Oct 2022 14:30:52 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D7BE4043479; Fri, 14 Oct 2022 14:30:52 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 29EEUnrU672031 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 14 Oct 2022 16:30:49 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29EEUnEk672030; Fri, 14 Oct 2022 16:30:49 +0200 From: Aldy Hernandez To: Jakub Jelinek Cc: GCC patches , Andrew MacLeod , Aldy Hernandez Subject: [PATCH] Check rvc_normal in real_isdenormal. Date: Fri, 14 Oct 2022 16:30:47 +0200 Message-Id: <20221014143047.672008-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: [Jakub, thanks for pointing this out. OK?] [-Inf, -Inf] is being flushed to [-Inf, -0.0] because real_isdenormal is being overly pessimistic. It is missing a check for rvc_normal. This doesn't cause problems in real.cc because all uses of real_isdenormal are already on the rvc_normal path. The uses in value-range.cc however, are not. This patch adds a check for rvc_normal. gcc/ChangeLog: * real.h (real_isdenormal): Check rvc_normal. * value-range.cc (range_tests_floats): New test. --- gcc/real.h | 2 +- gcc/value-range.cc | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/real.h b/gcc/real.h index f9528d765ec..306e9593866 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -290,7 +290,7 @@ extern bool real_issignaling_nan (const REAL_VALUE_TYPE *); inline bool real_isdenormal (const REAL_VALUE_TYPE *r) { - return (r->sig[SIGSZ-1] & SIG_MSB) == 0; + return r->cl == rvc_normal && (r->sig[SIGSZ-1] & SIG_MSB) == 0; } /* Determine whether a floating-point value X is finite. */ diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 6b4f3dddcd5..ee15eb35df8 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -4014,6 +4014,11 @@ range_tests_floats () r1.clear_nan (); r0.intersect (r1); ASSERT_TRUE (r0.undefined_p ()); + + // Make sure [-Inf, -Inf] doesn't get normalized. + r0 = frange_float ("-Inf", "-Inf"); + ASSERT_TRUE (real_isinf (&r0.lower_bound (), true)); + ASSERT_TRUE (real_isinf (&r0.upper_bound (), true)); } void -- 2.37.3