[PATCH] PR middle-end/103406: Check for Inf before simplifying x-x.

Roger Sayle roger@nextmovesoftware.com
Thu Nov 25 11:29:32 GMT 2021

This is a simple one line fix to the regression PR middle-end/103406,
where x - x is being folded to 0.0 even when x is +Inf or -Inf.
In GCC 11 and previously, we'd check whether the type honored NaNs
(which implicitly covered the case where the type honors infinities),
but my patch to test whether the operand could potentially be NaN
failed to also check whether the operand could potentially be Inf.

This patch doesn't address the issue of NaN signedness from binary
arithmetic operations, just the regression.

This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check with no new failures.  Ok for mainline?

2021-11-25  Roger Sayle  <roger@nextmovesoftware.com>

	PR middle-end/103406
	* match.pd (minus @0 @0): Check tree_expr_maybe_infinite_p.

	PR middle-end/103406
	* gcc.dg/pr103406.c: New test case.

Thanks in advance (and sorry for the inconvenience),

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchz.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211125/34cbb52e/attachment.txt>

More information about the Gcc-patches mailing list