[PATCH] Fix PR77407

Richard Biener rguenther@suse.de
Sat Oct 1 13:02:00 GMT 2016


On October 1, 2016 11:47:45 AM GMT+02:00, Robin Dapp <rdapp@linux.vnet.ibm.com> wrote:
>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?

No, I have a patch for genmatch in testing that fixes this.

Richard.

>Regards
> Robin




More information about the Gcc-patches mailing list