+2020-02-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93777
+ * region-model.cc (region_model::maybe_cast_1): Replace assertion
+ that build_cast returns non-NULL with a conditional, falling
+ through to the logic which returns a new unknown value of the
+ desired type if it fails.
+
2020-02-18 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93778
/* Attempt to cast constants. */
if (tree src_cst = sval->maybe_get_constant ())
{
- tree dst = build_cast (dst_type, src_cst);
- gcc_assert (dst != NULL_TREE);
- if (CONSTANT_CLASS_P (dst))
- return get_or_create_constant_svalue (dst);
+ if (tree dst = build_cast (dst_type, src_cst))
+ if (CONSTANT_CLASS_P (dst))
+ return get_or_create_constant_svalue (dst);
}
/* Otherwise, return a new unknown value. */
+2020-02-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93777
+ * g++.dg/analyzer/pr93777.C: New test.
+ * gfortran.dg/analyzer/pr93777.f90: New test.
+
2020-02-18 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93778
--- /dev/null
+#include "../../g++.old-deja/g++.pt/spec36.C"
--- /dev/null
+! { dg-additional-options "-O0 -Wno-analyzer-possible-null-dereference -Wno-analyzer-null-dereference -Wno-analyzer-malloc-leak" }
+
+program cb
+ implicit none
+ type :: jn
+ real, allocatable :: ie
+ character(len = :), allocatable :: e5
+ end type jn
+ real, parameter :: gm = 5.0
+
+ block
+ type(jn) :: r2
+
+ r2 = jn (gm, "")
+ call vz (r2%ie, gm)
+ end block
+contains
+ subroutine vz (arg1, arg2)
+ real :: arg1, arg2
+ if (arg1 .ne. arg2) STOP 1
+ end subroutine vz
+end program cb