aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/pr103248.c8
-rw-r--r--gcc/tree-eh.c12
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.dg/pr103248.c b/gcc/testsuite/gcc.dg/pr103248.c
new file mode 100644
index 0000000..da6232d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr103248.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fixed_point } */
+/* { dg-options "-fnon-call-exceptions" } */
+
+_Accum sa;
+int c;
+
+void div_csa() { c /= sa; }
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 3eff07f..916da85 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2474,10 +2474,16 @@ operation_could_trap_helper_p (enum tree_code op,
return false;
case RDIV_EXPR:
- if (honor_snans)
+ if (fp_operation)
+ {
+ if (honor_snans)
+ return true;
+ return flag_trapping_math;
+ }
+ /* Fixed point operations also use RDIV_EXPR. */
+ if (!TREE_CONSTANT (divisor) || fixed_zerop (divisor))
return true;
- gcc_assert (fp_operation);
- return flag_trapping_math;
+ return false;
case LT_EXPR:
case LE_EXPR: