https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #63 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note match.pd has a similar bug.  Here is the patch which fixes it:
diff --git a/gcc/match.pd b/gcc/match.pd
index 92b93b0..8607abe 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5676,16 +5676,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
       isize = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (@1)));
   }
   (switch
-   (if (wi::leu_p (wi::to_wide (@ipos), wi::to_wide (@rpos))
+   (if ((!INTEGRAL_TYPE_P (TREE_TYPE (@1)) || type_has_mode_precision_p
(TREE_TYPE (@1)))
+        && wi::leu_p (wi::to_wide (@ipos), wi::to_wide (@rpos))
        && wi::leu_p (wi::to_wide (@rpos) + wi::to_wide (@rsize),
                      wi::to_wide (@ipos) + isize))
     (BIT_FIELD_REF @1 @rsize { wide_int_to_tree (bitsizetype,
                                                  wi::to_wide (@rpos)
                                                 - wi::to_wide (@ipos)); }))
-   (if (wi::geu_p (wi::to_wide (@ipos),
-                  wi::to_wide (@rpos) + wi::to_wide (@rsize))
-       || wi::geu_p (wi::to_wide (@rpos),
-                     wi::to_wide (@ipos) + isize))
+   (if ((!INTEGRAL_TYPE_P (TREE_TYPE (@0)) || type_has_mode_precision_p
(TREE_TYPE (@0)))
+         && (wi::geu_p (wi::to_wide (@ipos),
+                       wi::to_wide (@rpos) + wi::to_wide (@rsize))
+            || wi::geu_p (wi::to_wide (@rpos),
+                          wi::to_wide (@ipos) + isize)))
     (BIT_FIELD_REF @0 @rsize @rpos)))))

 (if (canonicalize_math_after_vectorization_p ())

----- CUT ----
The second part should not be needed as the first operand to BIT_INSERT_EXPR
should always be type_has_mode_precision_p; though I have not looked to make
sure that is the case.

Reply via email to