re PR sanitizer/78832 (-fcompare-debug failure (length) with -fsanitize=address)

PR sanitizer/78832
	* sanopt.c (sanitize_asan_mark_unpoison): Remove next variable, use
	continue if gsi_next should be skipped.
	(sanitize_asan_mark_poison): Remove prev variable, use continue if
	gsi_prev should be skipped.  When removing ASAN_MARK, do gsi_prev
	first and gsi_remove on a previously made copy of the iterator.

	* gcc.dg/asan/pr78832.c: New test.

From-SVN: r243777
This commit is contained in:
Jakub Jelinek 2016-12-17 20:10:39 +01:00 committed by Jakub Jelinek
parent 63ac625170
commit 8ccaace835
4 changed files with 43 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2016-12-17 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/78832
* sanopt.c (sanitize_asan_mark_unpoison): Remove next variable, use
continue if gsi_next should be skipped.
(sanitize_asan_mark_poison): Remove prev variable, use continue if
gsi_prev should be skipped. When removing ASAN_MARK, do gsi_prev
first and gsi_remove on a previously made copy of the iterator.
2016-12-17 Andrew Senkevich <andrew.senkevich@intel.com>
* config/i386/avx512bwintrin.h: Add new k-mask intrinsics.

View File

@ -740,7 +740,6 @@ sanitize_asan_mark_unpoison (void)
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
bool next = true;
gimple *stmt = gsi_stmt (gsi);
if (gimple_call_internal_p (stmt, IFN_ASAN_MARK))
{
@ -753,12 +752,11 @@ sanitize_asan_mark_unpoison (void)
unlink_stmt_vdef (stmt);
release_defs (stmt);
gsi_remove (&gsi, true);
next = false;
continue;
}
}
if (next)
gsi_next (&gsi);
gsi_next (&gsi);
}
}
}
@ -840,7 +838,6 @@ sanitize_asan_mark_poison (void)
gimple_stmt_iterator gsi;
for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);)
{
bool prev = true;
gimple *stmt = gsi_stmt (gsi);
if (maybe_contains_asan_check (stmt))
break;
@ -850,12 +847,13 @@ sanitize_asan_mark_poison (void)
fprintf (dump_file, "Removing ASAN_MARK poison\n");
unlink_stmt_vdef (stmt);
release_defs (stmt);
gsi_remove (&gsi, true);
prev = false;
gimple_stmt_iterator gsi2 = gsi;
gsi_prev (&gsi);
gsi_remove (&gsi2, true);
continue;
}
if (prev)
gsi_prev (&gsi);
gsi_prev (&gsi);
}
}
}

View File

@ -1,3 +1,8 @@
2016-12-17 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/78832
* gcc.dg/asan/pr78832.c: New test.
2016-12-17 Andrew Senkevich <andrew.senkevich@intel.com>
* gcc.target/i386/avx512bw-kaddd-1.c: New test.

View File

@ -0,0 +1,22 @@
/* PR sanitizer/78832 */
/* { dg-do compile } */
/* { dg-additional-options "-fcompare-debug" } */
void bar (int *);
int
foo (int x)
{
int *f = 0;
if (x)
goto lab;
{
int y, z;
bar (&y);
int *d = &y;
bar (&z);
int *e = &z;
}
f = &x;
lab: return 6;
}