Jakub Jelinek wrote:
--- gcc/asan.c.orig     2012-11-09 21:26:26.000000000 +0100
+++ gcc/asan.c  2012-11-09 21:26:00.000000000 +0100
@@ -1362,6 +1362,8 @@ transform_statements (void)
            instrument_assignment (&i);
          else if (is_gimple_call (s))
            maybe_instrument_call (&i);
+         if (gsi_end_p (i))
+           break;
          }
      }
  }

That looks a wrong place for this.

I already expected that it was not fully correct ;-)


So untested:

Thanks for the patch! It fixed the problem half way: It fixes the second issue I had (fail10.ii, http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00791.html ).

However, it didn't fix the original problem: As the call for strlen directly returns, it never reaches your patch. Hence, it doesn't fix fail31.ii of http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00786.html

If one uses the same line for strlen, it works.

Updated patches attached – one is on top of the trunk + Dodji's patches, the other is on top of the asan branch.

 * * *

The question is whether one also needs to do something for the atomics handling in maybe_instrument_builtin_call, which has:
        instrument_derefs (iter, dest, loc, is_store);
        return;

The instrument_derefs calls - in some cases - build_check_stmt, which in turn calls:
  *iter = gsi_start_bb (else_bb)

Tobias
(This patch is for the "trunk" after the asan integration patches.)

2012-11-10  Jakub Jelinek  <ja...@redhat.com>
            Tobias Burnus  <bur...@net-b.de>

        * asan.c (maybe_instrument_builtin_call): Set *iter
        to gsi for the call at the end.

--- gcc/asan.c.orig	2012-11-09 21:26:26.000000000 +0100
+++ gcc/asan.c	2012-11-10 13:44:51.000000000 +0100
@@ -1068,6 +1068,7 @@ instrument_builtin_call (gimple_stmt_ite
 
     case BUILT_IN_STRLEN:
       instrument_strlen_call (iter);
+      *iter = gsi_for_stmt (call);
       return;
 
     /* And now the __atomic* and __sync builtins.
@@ -1307,6 +1308,7 @@ instrument_builtin_call (gimple_stmt_ite
       else if (dest != NULL_TREE)
 	instrument_mem_region_access (dest, len, iter,
 				      loc, /*is_store=*/true);
+      *iter = gsi_for_stmt (call);
     }
 }
 
(This patch is for the "asan" branch.)

2012-11-10  Jakub Jelinek  <ja...@redhat.com>
	    Tobias Burnus  <bur...@net-b.de>

	* asan.c (maybe_instrument_builtin_call): Set *iter
	to gsi for the call at the end.

diff --git a/gcc/asan.c b/gcc/asan.c
index 155e84b..3297b52 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -952,6 +952,7 @@ maybe_instrument_builtin_call (gimple_stmt_iterator *iter)
 
     case BUILT_IN_STRLEN:
       instrument_strlen_call (iter);
+      *iter = gsi_for_stmt (call);
       return true;
 
     /* And now the __atomic* and __sync builtins.
@@ -1191,6 +1192,7 @@ maybe_instrument_builtin_call (gimple_stmt_iterator *iter)
       else if (dest != NULL_TREE)
 	instrument_mem_region_access (dest, len, iter,
 				      loc, /*is_store=*/true);
+      *iter = gsi_for_stmt (call);
       return true;
     }
   return false;

Reply via email to