From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E601238582B8; Fri, 24 Nov 2023 09:33:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E601238582B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700818386; bh=iRe121IOpD8mASBGINblcGvaOU4RyPoe1gnPzv8DhkY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZQ+m1O9abFkX5jhYD8V0N9pmV5PhyBe4adprc5pcZ6QbWkLAzNEgTZqpBpbGTX8j7 5lTYdxYc/+lWrb7nim2PUfLyzGbI+F1/yRAGkxTJgYo2Q+R6R9ycJtp4tmj7nHD0ak 0V+Nmre/QQjQDqxc1RaZKgGvTlJNhOXw3IlESnC0= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111655] [11/12/13/14 Regression] wrong code generated for __builtin_signbit and 0./0. on x86-64 -O2 Date: Fri, 24 Nov 2023 09:33:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111655 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #12 from Jakub Jelinek --- Started with r6-3811-g68e57f040c6330eb853551622d458a67d6f9e572 on this testcase, but as pointed out tree_binary_nonnegative_warnv_p needs to be more careful. Given that tree_single_nonnegative_warnv_p may return true on REAL_CST NaN literal with sign bit unset, one question is if e.g. such NaN + nonnegative_value or nonnegative_value + such NaN could result in NaN result with negative sign, in that case even PLUS_EXPR if (FLOAT_TYPE_P (type)) return RECURSE (op0) && RECURSE (op1); would be incorrect and we'd need to guard it with && !tree_expr_maybe_nan_p (op0) && !tree_expr_maybe_nan_p (op1). Then there is the MULT_EXPR x * x case, that might suffer from similar prob= lem to PLUS_EXPR if NaN with positive sign * NaN with positive sign can result = in NaN with negative sign. Then there is the MULT_EXPR RECURSE (op0) && RECUR= SE (op1) case, that one can certainly result in possibly NaN if one operand is 0 and another +i= nf, so we'd need to guard it for FLOAT_TYPE_P with (tree_expr_nonzero_warnv_p (op0, strict_overflow_p) || !tree_expr_maybe_infinite_p (op1)) && (tree_expr_nonzero_warnv_p (op1, strict_overflow_p) || !tree_expr_maybe_infinite_p (op0)) And then RDIV_EXPR, again corresponding checks.=