This avoids running into the assert in compute_distributive_range when
starting the analysis with operations in a trapping type.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-10-20  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/102853
        * tree-data-ref.c (split_constant_offset_1): Bail out
        immediately if the expression traps on overflow.
---
 gcc/tree-data-ref.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 57bac06242f..46f4ffedb48 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -757,6 +757,9 @@ split_constant_offset_1 (tree type, tree op0, enum 
tree_code code, tree op1,
   *var = NULL_TREE;
   *off = NULL_TREE;
 
+  if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type))
+    return false;
+
   switch (code)
     {
     case INTEGER_CST:
-- 
2.31.1

Reply via email to