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.
+2020-01-17 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/analyzer.texi (Limitations): Add note about NaN.
+
2020-01-17 Mihail-Calin Ionescu <mihail.ionescu@arm.com>
Sudakshina Das <sudi.das@arm.com>
+2020-01-17 David Malcolm <dmalcolm@redhat.com>
+
+ 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.
+
2020-01-17 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93281
{
if (lhs == rhs)
{
- /* If we have the same svalue, then we have equality.
+ /* If we have the same svalue, then we have equality
+ (apart from NaN-handling).
TODO: should this definitely be the case for poisoned values? */
switch (op)
{
- default:
- gcc_unreachable ();
-
case EQ_EXPR:
case GE_EXPR:
case LE_EXPR:
case GT_EXPR:
case LT_EXPR:
return tristate::TS_FALSE;
+
+ default:
+ /* For other ops, use the logic below. */
+ break;
}
}
@item
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.
+@item
The region model code creates lots of little mutable objects at each
@code{region_model} (and thus per @code{exploded_node}) rather than
sharing immutable objects and having the mutable state in the
+2020-01-17 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93290
+ * gcc.dg/analyzer/pr93290.c: New test.
+
2020-01-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/92542
--- /dev/null
+#include <math.h>
+
+int test_1 (void)
+{
+ float foo = 42.;
+ if (isnan (foo))
+ return 1;
+ return 0;
+}