Commit 0757674c by Marek Polacek Committed by Marek Polacek

re PR sanitizer/65367 (indefinite loop occurs with sanitize enabled and certain…

re PR sanitizer/65367 (indefinite loop occurs with sanitize enabled and certain optimization options)

	PR sanitizer/65367
	* ubsan.c (ubsan_expand_objsize_ifn): Update GSI instead of GSI_ORIG
	when only removing the statement.  Handle expanding UBSAN_OBJECT_SIZE
	separately.

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

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

From-SVN: r221325
parent dac2639d
2015-03-10 Marek Polacek <polacek@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR sanitizer/65367
* ubsan.c (ubsan_expand_objsize_ifn): Update GSI instead of GSI_ORIG
when only removing the statement. Handle expanding UBSAN_OBJECT_SIZE
separately.
2015-03-10 Jakub Jelinek <jakub@redhat.com> 2015-03-10 Jakub Jelinek <jakub@redhat.com>
PR target/65286 PR target/65286
......
2015-03-10 Marek Polacek <polacek@redhat.com>
PR sanitizer/65367
* c-c++-common/ubsan/pr65367.c: New test.
2015-03-10 Ilya Enkovich <ilya.enkovich@intel.com> 2015-03-10 Ilya Enkovich <ilya.enkovich@intel.com>
* lib/mpx-dg.exp (mpx_link_flags): Set path to wrappers library. * lib/mpx-dg.exp (mpx_link_flags): Set path to wrappers library.
......
/* PR sanitizer/65367 */
/* { dg-do compile } */
/* { dg-options "-fno-tree-ccp -fno-tree-copy-prop -fno-tree-dominator-opts -fno-tree-fre -fsanitize=object-size" } */
int
foo (char *p)
{
return *((const char *) "") - *p;
}
...@@ -1022,12 +1022,17 @@ ubsan_expand_objsize_ifn (gimple_stmt_iterator *gsi) ...@@ -1022,12 +1022,17 @@ ubsan_expand_objsize_ifn (gimple_stmt_iterator *gsi)
/* Point GSI to next logical statement. */ /* Point GSI to next logical statement. */
*gsi = gsi_start_bb (fallthru_bb); *gsi = gsi_start_bb (fallthru_bb);
}
/* Get rid of the UBSAN_OBJECT_SIZE call from the IR. */ /* Get rid of the UBSAN_OBJECT_SIZE call from the IR. */
unlink_stmt_vdef (stmt); unlink_stmt_vdef (stmt);
gsi_remove (&gsi_orig, true); gsi_remove (&gsi_orig, true);
return true; return true;
}
/* Get rid of the UBSAN_OBJECT_SIZE call from the IR. */
unlink_stmt_vdef (stmt);
gsi_remove (gsi, true);
return true;
} }
/* Cached __ubsan_vptr_type_cache decl. */ /* Cached __ubsan_vptr_type_cache decl. */
......
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