const svalue *src_contents_sval
= model->get_store_value (sized_src_reg, cd.get_ctxt ());
model->check_for_poison (src_contents_sval, cd.get_arg_tree (1),
- cd.get_ctxt ());
+ sized_src_reg, cd.get_ctxt ());
model->set_value (sized_dest_reg, src_contents_sval, cd.get_ctxt ());
}
tree src_expr = input_tvec[i];
const svalue *src_sval = get_rvalue (src_expr, ctxt);
- check_for_poison (src_sval, src_expr, ctxt);
+ check_for_poison (src_sval, src_expr, NULL, ctxt);
input_svals.quick_push (src_sval);
reachable_regs.handle_sval (src_sval);
/* Check for SVAL being poisoned, adding a warning to CTXT.
Return SVAL, or, if a warning is added, another value, to avoid
- repeatedly complaining about the same poisoned value in followup code. */
+ repeatedly complaining about the same poisoned value in followup code.
+ SRC_REGION is a hint about where SVAL came from, and can be NULL. */
const svalue *
region_model::check_for_poison (const svalue *sval,
tree expr,
+ const region *src_region,
region_model_context *ctxt) const
{
if (!ctxt)
the tree other than via the def stmts, using
fixup_tree_for_diagnostic. */
tree diag_arg = fixup_tree_for_diagnostic (expr);
- const region *src_region = NULL;
- if (pkind == POISON_KIND_UNINIT)
+ if (src_region == NULL && pkind == POISON_KIND_UNINIT)
src_region = get_region_for_poisoned_expr (expr);
if (ctxt->warn (make_unique<poisoned_value_diagnostic> (diag_arg,
pkind,
if (const svalue *sval = get_gassign_result (assign, ctxt))
{
tree expr = get_diagnostic_tree_for_gassign (assign);
- check_for_poison (sval, expr, ctxt);
+ check_for_poison (sval, expr, NULL, ctxt);
set_value (lhs_reg, sval, ctxt);
return;
}
assert_compat_types (result_sval->get_type (), TREE_TYPE (pv.m_tree));
- result_sval = check_for_poison (result_sval, pv.m_tree, ctxt);
+ result_sval = check_for_poison (result_sval, pv.m_tree, NULL, ctxt);
return result_sval;
}
in_va_list
= model->check_for_poison (in_va_list,
get_va_list_diag_arg (cd.get_arg_tree (1)),
+ NULL,
cd.get_ctxt ());
const region *out_dst_reg
ap_sval = cast;
tree va_list_tree = get_va_list_diag_arg (cd.get_arg_tree (0));
- ap_sval = model->check_for_poison (ap_sval, va_list_tree, ctxt);
+ ap_sval = model->check_for_poison (ap_sval, va_list_tree, ap_reg, ctxt);
if (const region *impl_reg = ap_sval->maybe_get_region ())
{