Commit 29c94e65 by Marek Polacek Committed by Marek Polacek

re PR sanitizer/70875 (ICE in get_ubsan_type_info_for_type with -fsanitize=undefined)

	PR sanitizer/70875
	* ubsan.c (get_ubsan_type_info_for_type): Remove assert.

	* gcc.dg/ubsan/bounds-3.c: New test.

From-SVN: r235951
parent 3684b02e
2016-05-06 Marek Polacek <polacek@redhat.com>
PR sanitizer/70875
* ubsan.c (get_ubsan_type_info_for_type): Remove assert.
2016-05-06 Oleg Endo <olegendo@gcc.gnu.org>
PR target/54089
......
2016-05-06 Marek Polacek <polacek@redhat.com>
PR sanitizer/70875
* gcc.dg/ubsan/bounds-3.c: New test.
2016-05-06 Oleg Endo <olegendo@gcc.gnu.org>
PR target/54089
......
/* PR sanitizer/70875 */
/* { dg-do run } */
/* { dg-options "-fsanitize=bounds" } */
int
foo (int n, int k)
{
struct S
{
int i[n];
int value;
} s[2];
return s[k].value = 0;
}
int
main ()
{
return foo (2, 2);
}
/* { dg-output "index 2 out of bounds for type 'S \\\[2\\\]'" } */
......@@ -302,7 +302,6 @@ ubsan_source_location (location_t loc)
static unsigned short
get_ubsan_type_info_for_type (tree type)
{
gcc_assert (TYPE_SIZE (type) && tree_fits_uhwi_p (TYPE_SIZE (type)));
if (TREE_CODE (type) == REAL_TYPE)
return tree_to_uhwi (TYPE_SIZE (type));
else if (INTEGRAL_TYPE_P (type))
......
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