Commit 96281645 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/83014 (ICE in pretty-print with -fsanitize=bounds)

	PR sanitizer/83014
	* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
	instead of pp_printf with HOST_WIDE_INT_PRINT_DEC.  Avoid calling
	tree_to_uhwi twice.

	* gcc.dg/ubsan/pr83014.c: New test.

From-SVN: r255134
parent 51feb980
2017-11-24 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/83014
* ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
instead of pp_printf with HOST_WIDE_INT_PRINT_DEC. Avoid calling
tree_to_uhwi twice.
* tree-object-size.c (pass_through_call): Use gimple_call_return_flags
ERF_RETURN*ARG* for builtins other than BUILT_IN_ASSUME_ALIGNED,
check for the latter with gimple_call_builtin_p. Do not handle
2017-11-24 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/83014
* gcc.dg/ubsan/pr83014.c: New test.
* gcc.dg/builtin-object-size-18.c: New test.
2017-11-23 Julia Koval <julia.koval@intel.com>
......
/* PR sanitizer/83014 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined" } */
int
foo (void)
{
int data[5];
data[0] = 0;
data[5] = 0;
return data[0];
}
......@@ -436,10 +436,10 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style pstyle)
&& TYPE_MAX_VALUE (dom) != NULL_TREE
&& TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
{
unsigned HOST_WIDE_INT m;
if (tree_fits_uhwi_p (TYPE_MAX_VALUE (dom))
&& tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1 != 0)
pp_printf (&pretty_name, HOST_WIDE_INT_PRINT_DEC,
tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1);
&& (m = tree_to_uhwi (TYPE_MAX_VALUE (dom))) + 1 != 0)
pp_unsigned_wide_integer (&pretty_name, m + 1);
else
pp_wide_int (&pretty_name,
wi::add (wi::to_widest (TYPE_MAX_VALUE (dom)), 1),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment