diff options
-rw-r--r-- | gcc/config/aarch64/aarch64-early-ra.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr116927-1.C | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64-early-ra.cc b/gcc/config/aarch64/aarch64-early-ra.cc index 5f269d0..6e544dd 100644 --- a/gcc/config/aarch64/aarch64-early-ra.cc +++ b/gcc/config/aarch64/aarch64-early-ra.cc @@ -3389,6 +3389,12 @@ early_ra::is_dead_insn (rtx_insn *insn) if (side_effects_p (set)) return false; + /* If we can't delete dead exceptions and the insn throws, + then the instruction is not dead. */ + if (!cfun->can_delete_dead_exceptions + && !insn_nothrow_p (insn)) + return false; + return true; } diff --git a/gcc/testsuite/g++.dg/torture/pr116927-1.C b/gcc/testsuite/g++.dg/torture/pr116927-1.C new file mode 100644 index 0000000..22fa1db --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr116927-1.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-additional-options "-fnon-call-exceptions -fno-delete-dead-exceptions" } + +// PR target/116927 +// aarch64's Early ra was removing possiblely trapping +// floating point insn + +void +foo (float f) +{ + try { + f ++; + }catch(...) + {} +} |