diff options
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r-- | gcc/sanopt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c index f6e8ee71d70..e1d11e0d5e6 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -418,10 +418,11 @@ sanopt_optimize_walker (basic_block bb, struct sanopt_ctx *ctx) { /* Handle asm volatile or asm with "memory" clobber the same as potentionally freeing call. */ - if (gimple_code (stmt) == GIMPLE_ASM + gasm *asm_stmt = dyn_cast <gasm *> (stmt); + if (asm_stmt && asan_check_optimize - && (gimple_asm_clobbers_memory_p (stmt) - || gimple_asm_volatile_p (stmt))) + && (gimple_asm_clobbers_memory_p (asm_stmt) + || gimple_asm_volatile_p (asm_stmt))) info->freeing_call_events++; gsi_next (&gsi); continue; |