* tree-chkp.c (chkp_get_hard_register_var_fake_base_address):
Rewritten to avoid overflow for > 32-bit pointers.
From-SVN: r249398
-2017-06-20 Jakub Jelinek <jakub@redhat.com>
+2017-07-20 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-chkp.c (chkp_get_hard_register_var_fake_base_address):
+ Rewritten to avoid overflow for > 32-bit pointers.
PR sanitizer/81125
* ubsan.h (ubsan_encode_value): Workaround buggy clang++ parser
static tree
chkp_get_hard_register_var_fake_base_address ()
{
- tree base = fold_convert (ptr_type_node, integer_zero_node);
- unsigned HOST_WIDE_INT offset = 1 << (TYPE_PRECISION (ptr_type_node) - 1);
- return fold_build_pointer_plus_hwi (base, offset);
+ int prec = TYPE_PRECISION (ptr_type_node);
+ return wide_int_to_tree (ptr_type_node, wi::min_value (prec, SIGNED));
}
/* If we check bounds for a hard register variable, we cannot