analyzer: prevent ICE on isnan (PR 93290)
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 16 Jan 2020 14:46:30 +0000 (09:46 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 17 Jan 2020 21:41:34 +0000 (16:41 -0500)
commit07c86323a199ca15177d99ad6c488b8f5fb5c729
treee9da8dfdc507949b6c74aa2df72774704eca663c
parent82033483fd74b1dcedab416d98673e212258498d
analyzer: prevent ICE on isnan (PR 93290)

PR analyzer/93290 reports an ICE on calls to isnan().
The root cause is that an UNORDERED_EXPR is passed
to region_model::eval_condition_without_cm, and there's
a stray gcc_unreachable () in the case where we're comparing
an svalue against itself.

I attempted a more involved patch that properly handled NaN in general
but it seems I've baked the assumption of reflexivity too deeply into
the constraint_manager code.

For now, this patch avoids the ICE and documents the limitation.

gcc/analyzer/ChangeLog:
PR analyzer/93290
* region-model.cc (region_model::eval_condition_without_cm): Avoid
gcc_unreachable for unexpected operations for the case where
we're comparing an svalue against itself.

gcc/ChangeLog
* doc/analyzer.texi (Limitations): Add note about NaN.

gcc/testsuite/ChangeLog:
PR analyzer/93290
* gcc.dg/analyzer/pr93290.c: New test.
gcc/ChangeLog
gcc/analyzer/ChangeLog
gcc/analyzer/region-model.cc
gcc/doc/analyzer.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/pr93290.c [new file with mode: 0644]