Commit 7d1f4ae5 by Marek Polacek Committed by Marek Polacek

re PR tree-optimization/64121 (ICE: SSA corruption with -O -fsanitize=undefined)

	PR sanitizer/64121
	* ubsan.c (instrument_object_size): Stop searching if the base
	occurs in abnormal phi.

	* c-c++-common/ubsan/pr64121.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r218222
parent 0b274c17
2014-12-01 Marek Polacek <polacek@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR sanitizer/64121
* ubsan.c (instrument_object_size): Stop searching if the base
occurs in abnormal phi.
2014-12-01 Marek Polacek <polacek@redhat.com>
PR sanitizer/63956
* ubsan.c (is_ubsan_builtin_p): Check also built-in class.
2014-12-01 Marek Polacek <polacek@redhat.com>
PR sanitizer/64121
* c-c++-common/ubsan/pr64121.c: New test.
2014-12-01 Marek Polacek <polacek@redhat.com>
PR sanitizer/63956
* c-c++-common/ubsan/shift-5.c: Add xfails.
* g++.dg/ubsan/div-by-zero-1.C: Don't use -w. Add xfail.
......
/* PR sanitizer/64121 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -Wno-pointer-arith" } */
extern int tab[16];
void
execute (int *ip, int x)
{
int *xp = tab;
base:
if (x)
return;
*xp++ = *ip;
goto *(&&base + *ip);
}
......@@ -1563,7 +1563,14 @@ instrument_object_size (gimple_stmt_iterator *gsi, bool is_lhs)
&& POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (def_stmt))))
|| (is_gimple_assign (def_stmt)
&& gimple_assign_rhs_code (def_stmt) == POINTER_PLUS_EXPR))
base = gimple_assign_rhs1 (def_stmt);
{
tree rhs1 = gimple_assign_rhs1 (def_stmt);
if (TREE_CODE (rhs1) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1))
break;
else
base = rhs1;
}
else
break;
}
......
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