From: Jakub Jelinek Date: Fri, 5 Dec 2014 23:00:09 +0000 (+0100) Subject: re PR sanitizer/64170 (ICE compiling Linux Kernel drivers/media/rc/imon.c in imon_inc... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06dd2aceb1855a33008066e285db77e28bbffa16;p=gcc.git re PR sanitizer/64170 (ICE compiling Linux Kernel drivers/media/rc/imon.c in imon_incoming_packet) PR sanitizer/64170 * sanopt.c (maybe_optimize_asan_check_ifn): If base_checks is non-NULL, call maybe_get_dominating_check on it even if g is non-NULL. * gcc.dg/asan/pr64170.c: New test. From-SVN: r218440 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0dcf6498e32..f9fba3e6ce1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-05 Jakub Jelinek + + PR sanitizer/64170 + * sanopt.c (maybe_optimize_asan_check_ifn): If base_checks is + non-NULL, call maybe_get_dominating_check on it even if g is + non-NULL. + 2014-12-05 Jeff Law * doc/md.texi: Note problems using function calls to determine diff --git a/gcc/sanopt.c b/gcc/sanopt.c index e0d3a8562b3..ce9fbcf604a 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -408,12 +408,13 @@ maybe_optimize_asan_check_ifn (struct sanopt_ctx *ctx, gimple stmt) } gimple g = maybe_get_dominating_check (*ptr_checks); + gimple g2 = NULL; - if (!g && base_checks) + if (base_checks) /* Try with base address as well. */ - g = maybe_get_dominating_check (*base_checks); + g2 = maybe_get_dominating_check (*base_checks); - if (!g) + if (g == NULL && g2 == NULL) { /* For this PTR we don't have any ASAN_CHECK stmts recorded, so there's nothing to optimize yet. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dcef9d2c3d6..b52905e34f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-05 Jakub Jelinek + + PR sanitizer/64170 + * gcc.dg/asan/pr64170.c: New test. + 2014-12-05 Michael Meissner PR target/53199 diff --git a/gcc/testsuite/gcc.dg/asan/pr64170.c b/gcc/testsuite/gcc.dg/asan/pr64170.c new file mode 100644 index 00000000000..c4edcaa39d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr64170.c @@ -0,0 +1,17 @@ +/* PR sanitizer/64170 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=address,null" } */ + +int a, *b, c; +void bar (int); + +void +foo (void) +{ + char *d = (char *) b; + if (d[0] && d[1]) + return; + if (c) + a = *(int *) d; + bar (*(int *) d); +}