diff --git a/gcc/avoid-store-forwarding.cc b/gcc/avoid-store-forwarding.cc index b1fa1678dc30a3db75e4400cfee0a3391ddc18d7..1b8c35bc6cb7b497a364a38c69b9fdb34bc16f2e 100644 --- a/gcc/avoid-store-forwarding.cc +++ b/gcc/avoid-store-forwarding.cc @@ -429,7 +429,7 @@ store_forwarding_analyzer::avoid_store_forwarding (basic_block bb) rtx set = single_set (insn); - if (!set) + if (!set || insn_could_throw_p (insn)) { store_exprs.truncate (0); continue; diff --git a/gcc/testsuite/gcc.dg/pr117816.c b/gcc/testsuite/gcc.dg/pr117816.c new file mode 100644 index 0000000000000000000000000000000000000000..6a9fc5fa1415c327bb9f09ec113506f66e25871c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr117816.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fnon-call-exceptions -favoid-store-forwarding -fno-forward-propagate -finstrument-functions" } */ + +char *p; +int y; +long x; + +void foo() +{ + x /= *(int *)__builtin_memmove(&y, 4 + p, 3); +}