Commit 786c6d10 by Marek Polacek Committed by Marek Polacek

re PR sanitizer/81223 (ICE in instrument_null at gcc/ubsan.c:1230)

	PR sanitizer/81223
	* ubsan.c (instrument_null): Check get_base_address's result for null.

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

From-SVN: r249687
parent 1e7df2e6
2017-06-27 Marek Polacek <polacek@redhat.com>
PR sanitizer/81223
* ubsan.c (instrument_null): Check get_base_address's result for null.
2017-06-27 Marc Glisse <marc.glisse@inria.fr>
* match.pd ((A+-B)+(C-A), (A+B)-(A-C)): New transformations.
......
2017-06-27 Marek Polacek <polacek@redhat.com>
PR sanitizer/81223
* gcc.dg/ubsan/pr81223.c: New test.
2017-06-27 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/tree-ssa/assoc-1.c: New file.
......
/* PR sanitizer/81223 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined" } */
void bar ();
void
foo (int x)
{
struct S { char a[x]; } v;
bar (v);
}
......@@ -1228,7 +1228,8 @@ instrument_null (gimple_stmt_iterator gsi, tree t, bool is_lhs)
if (TREE_CODE (t) == ADDR_EXPR)
t = TREE_OPERAND (t, 0);
tree base = get_base_address (t);
if (TREE_CODE (base) == MEM_REF
if (base != NULL_TREE
&& TREE_CODE (base) == MEM_REF
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
instrument_mem_ref (t, base, &gsi, is_lhs);
}
......
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