From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1011) id 7175A3858C20; Thu, 8 Jun 2023 18:57:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7175A3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686250642; bh=FJS/nSl+3DP6RqwXvfp9edS9sjhBc77UJpDYNqBDrb0=; h=From:To:Subject:Date:From; b=TKaal0+o0XslymLOGHpib8H0odyASXWsT6RcuNnpbuRrb1XzzL2Hl5I8Ec/V1PbvN DqBsbwNdhcbHjs9CQeHqgVUrZTQFyTPQHkQgetk4yt9b6wVewCQAJ9adJXlNuncOgr AvyQ9V8JxA1GsCeMsWeLUydg1tWX2vZzOiTy4JRg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Macleod To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1634] Fix floating point bug in fold_range. X-Act-Checkin: gcc X-Git-Author: Andrew MacLeod X-Git-Refname: refs/heads/master X-Git-Oldrev: 1379ae33e05c28d705f3c69a3f6c774bf6e83136 X-Git-Newrev: ce81740c44c07a82a0839fa8c08a0a51a72c5cfe Message-Id: <20230608185722.7175A3858C20@sourceware.org> Date: Thu, 8 Jun 2023 18:57:22 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ce81740c44c07a82a0839fa8c08a0a51a72c5cfe commit r14-1634-gce81740c44c07a82a0839fa8c08a0a51a72c5cfe Author: Andrew MacLeod Date: Wed Jun 7 14:03:35 2023 -0400 Fix floating point bug in fold_range. We currently do not have any floating point operators where operand 1 is a different type than the LHS. When we eventually do there is a bug in fold_range. If either operand is a known NAN, it returns a NAN of the type of operand 1 instead of the result type. * range-op-float.cc (range_operator_float::fold_range): Return NAN of the result type. Diff: --- gcc/range-op-float.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index a99a6b01ed8..af598b60a79 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -57,7 +57,7 @@ range_operator_float::fold_range (frange &r, tree type, return true; if (op1.known_isnan () || op2.known_isnan ()) { - r.set_nan (op1.type ()); + r.set_nan (type); return true; }