aboutsummaryrefslogtreecommitdiff
path: root/gcc/sanopt.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2016-10-25 16:16:10 +0200
committerMartin Liska <marxin@gcc.gnu.org>2016-10-25 14:16:10 +0000
commit8e104951788de1a591287637d2b29fa37d8822ea (patch)
tree18fc8d8acdae6c8a7b6ba799f256667fab11c24b /gcc/sanopt.c
parentb93ee1bb06d43c0547b4de6f1389deafa28a474c (diff)
downloadgcc-8e104951788de1a591287637d2b29fa37d8822ea.zip
gcc-8e104951788de1a591287637d2b29fa37d8822ea.tar.gz
gcc-8e104951788de1a591287637d2b29fa37d8822ea.tar.bz2
Fix not caught use-after-scope with -O1 (PR sanitize/78106)
PR sanitizer/78106 * sanopt.c (imm_dom_path_with_freeing_call): Handle gasm statements as they can also contain possibly a freeing call. PR sanitizer/78106 * gcc.dg/asan/pr78106.c: New test. From-SVN: r241511
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r--gcc/sanopt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index 27c43da..8a6fbe9 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -211,8 +211,12 @@ imm_dom_path_with_freeing_call (basic_block bb, basic_block dom)
for (gsi = gsi_start_bb (e->src); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
+ gasm *asm_stmt;
- if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt))
+ if ((is_gimple_call (stmt) && !nonfreeing_call_p (stmt))
+ || ((asm_stmt = dyn_cast <gasm *> (stmt))
+ && (gimple_asm_clobbers_memory_p (asm_stmt)
+ || gimple_asm_volatile_p (asm_stmt))))
{
pred_info->has_freeing_call_p = true;
break;