diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-01-30 12:35:46 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-30 19:00:41 -0500 |
commit | e978955dd720d5cc0e5141a1e9bbbbb943a3cc41 (patch) | |
tree | 54cc29a0b7b7bbe52bd7dd7b9f81cf575aae9053 /gcc/doc/analyzer.texi | |
parent | f9eb0973edb2b4eed4cdbba7105b8af7afe5b547 (diff) | |
download | gcc-e978955dd720d5cc0e5141a1e9bbbbb943a3cc41.zip gcc-e978955dd720d5cc0e5141a1e9bbbbb943a3cc41.tar.gz gcc-e978955dd720d5cc0e5141a1e9bbbbb943a3cc41.tar.bz2 |
analyzer: fix ICE in __builtin_isnan (PR 93356)
PR analyzer/93356 reports an ICE handling __builtin_isnan due to a
failing assertion:
674 gcc_assert (lhs_ec_id != rhs_ec_id);
with op=UNORDERED_EXPR.
when attempting to add an UNORDERED_EXPR constraint.
This is an overzealous assertion, but underlying it are various forms of
sloppiness regarding NaN within the analyzer:
(a) the assumption in the constraint_manager that equivalence classes
are reflexive (X == X), which isn't the case for NaN.
(b) Hardcoding the "honor_nans" param to false when calling
invert_tree_comparison throughout the analyzer.
(c) Ignoring ORDERED_EXPR, UNORDERED_EXPR, and the UN-prefixed
comparison codes.
I wrote a patch for this which tracks the NaN-ness of floating-point
values and uses this to address all of the above.
However, to minimize changes in gcc 10 stage 4, here's a simpler patch
which rejects attempts to query or add constraints on floating-point
values, instead treating any floating-point comparison as "unknown", and
silently dropping the constraints at edges.
gcc/analyzer/ChangeLog:
PR analyzer/93356
* region-model.cc (region_model::eval_condition): In both
overloads, bail out immediately on floating-point types.
(region_model::eval_condition_without_cm): Likewise.
(region_model::add_constraint): Likewise.
gcc/testsuite/ChangeLog:
PR analyzer/93356
* gcc.dg/analyzer/conditionals-notrans.c (test_float_selfcmp):
Add.
* gcc.dg/analyzer/conditionals-trans.c: Mark floating point
comparison test as failing.
(test_float_selfcmp): Add.
* gcc.dg/analyzer/data-model-1.c: Mark floating point comparison
tests as failing.
* gcc.dg/analyzer/torture/pr93356.c: New test.
gcc/ChangeLog:
PR analyzer/93356
* doc/analyzer.texi (Limitations): Note that constraints on
floating-point values are currently ignored.
Diffstat (limited to 'gcc/doc/analyzer.texi')
-rw-r--r-- | gcc/doc/analyzer.texi | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/doc/analyzer.texi b/gcc/doc/analyzer.texi index 81acdd8..1fe4bce 100644 --- a/gcc/doc/analyzer.texi +++ b/gcc/doc/analyzer.texi @@ -390,6 +390,8 @@ Lack of function pointer analysis @item The constraint-handling code assumes reflexivity in some places (that values are equal to themselves), which is not the case for NaN. +As a simple workaround, constraints on floating-point values are +currently ignored. @item The region model code creates lots of little mutable objects at each @code{region_model} (and thus per @code{exploded_node}) rather than |