+2020-03-13 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/94099
+ PR analyzer/94105
+ * diagnostic-manager.cc (for_each_state_change): Bulletproof
+ against errors in get_rvalue by passing a
+ tentative_region_model_context and rejecting if there's an error.
+ * region-model.cc (region_model::get_lvalue_1): When handling
+ ARRAY_REF, handle results of error-handling. Handle NOP_EXPR.
+
2020-03-06 David Malcolm <dmalcolm@redhat.com>
* analyzer.h (class array_region): New forward decl.
if (dst_pv->m_stack_depth
>= src_state.m_region_model->get_stack_depth ())
continue;
+ tentative_region_model_context ctxt;
svalue_id src_sid
- = src_state.m_region_model->get_rvalue (*dst_pv, NULL);
- if (src_sid.null_p ())
+ = src_state.m_region_model->get_rvalue (*dst_pv, &ctxt);
+ if (src_sid.null_p () || ctxt.had_errors_p ())
continue;
state_machine::state_t src_sm_val = src_smap.get_state (src_sid);
if (dst_sm_val != src_sm_val)
region_id array_rid = get_lvalue (array, ctxt);
svalue_id index_sid = get_rvalue (index, ctxt);
- array_region *array_reg = get_region<array_region> (array_rid);
+ region *base_array_reg = get_region (array_rid);
+ array_region *array_reg = base_array_reg->dyn_cast_array_region ();
+ if (!array_reg)
+ {
+ /* Normally, array_rid ought to refer to an array_region, since
+ array's type will be ARRAY_TYPE. However, if we have an
+ unexpected tree code for array, we could have a
+ symbolic_region here. If so, we're in error-handling. */
+ gcc_assert (base_array_reg->get_type () == NULL_TREE);
+ return make_region_for_unexpected_tree_code (ctxt, expr,
+ dump_location_t ());
+ }
return array_reg->get_element (this, array_rid, index_sid, ctxt);
}
break;
}
break;
+ case NOP_EXPR:
case VIEW_CONVERT_EXPR:
{
tree obj = TREE_OPERAND (expr, 0);
+2020-03-13 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/94099
+ PR analyzer/94105
+ * gcc.dg/analyzer/pr94099.c: New test.
+ * gcc.dg/analyzer/pr94105.c: New test.
+
2020-03-13 Vasee Vinayagamoorthy <vaseeharan.vinayagamoorthy@arm.com>
* gcc.target/aarch64/advsimd-intrinsics/bfcvt-nosimd.c: Fix DejaGnu
--- /dev/null
+/* { dg-additional-options "-O1" } */
+
+struct cg {
+ int hk;
+ int *bg;
+};
+
+union vb {
+ struct cg gk;
+};
+
+void
+l3 (union vb *);
+
+void
+pl (void)
+{
+ union vb th = { 0, };
+ int sc;
+
+ for (sc = 0; sc < 1; ++sc)
+ {
+ th.gk.hk = 0;
+ th.gk.bg[sc] = 0; /* { dg-warning "uninitialized" } */
+ l3 (&th);
+ }
+}
--- /dev/null
+/* { dg-do compile } */
+
+#include "../../c-c++-common/torture/pr58794-1.c"