This introduces an ICE ("bogus comparison result type") on s390 for the
following test case:

#include <stdlib.h>

void foo(int dim)
{
   int ba, sign;

   ba = abs (dim);
   sign = dim / ba;
}


Doing

diff --git a/gcc/match.pd b/gcc/match.pd
index ba7e013..2455592 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -158,7 +158,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (div @0 (abs @0))
    (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
    && TYPE_OVERFLOW_UNDEFINED (type))
-    (cond (lt @0 { build_zero_cst (type); })
+    (cond (convert (lt @0 { build_zero_cst (type); }))
           { build_minus_one_cst (type); } { build_one_cst (type); })))
  /* X / -X is -1.  */
  (simplify

fixes the ICE but is that necessary and/or the right thing to do?

Regards
 Robin

Reply via email to