[Bug analyzer/93356] ICE in add_constraint, at analyzer/constraint-manager.cc:672

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 31 00:04:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93356

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:e978955dd720d5cc0e5141a1e9bbbbb943a3cc41

commit r10-6361-ge978955dd720d5cc0e5141a1e9bbbbb943a3cc41
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Jan 30 12:35:46 2020 -0500

    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.


More information about the Gcc-bugs mailing list