https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128306
Bug ID: 128306
Summary: `a - a` for real types where a is not a NaN can be
assumed to be >= 0
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 85316
Target Milestone: ---
Created attachment 66040
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66040&action=edit
testcase
The attached testcase should just be optimized to `return 0`. Without trapping
math enabled for sure. I am not 100% sure it can be optimized to that with
trapping math. I am not sure about the rules of fp exceptions for `a - a`.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases