Hi!

On s390x-linux I've run into the gcc.dg/torture/bitint-27.c test ICEing in
build_nonstandard_integer_type called from convert_affine_scev (not sure
why it doesn't trigger on x86_64/aarch64).
The problem is clear, when ct is a BITINT_TYPE with some large
TYPE_PRECISION, build_nonstandard_integer_type won't really work on it.

The patch fixes it similarly what has been done for GCC 14 in various
other spots.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2025-05-19  Jakub Jelinek  <ja...@redhat.com>

        * tree-chrec.cc (convert_affine_scev): Use signed_type_for instead of
        build_nonstandard_integer_type.

--- gcc/tree-chrec.cc.jj        2025-04-08 14:09:24.743815607 +0200
+++ gcc/tree-chrec.cc   2025-05-15 16:06:05.383354229 +0200
@@ -1490,7 +1490,7 @@ convert_affine_scev (class loop *loop, t
   new_step = *step;
   if (TYPE_PRECISION (step_type) > TYPE_PRECISION (ct) && TYPE_UNSIGNED (ct))
     {
-      tree signed_ct = build_nonstandard_integer_type (TYPE_PRECISION (ct), 0);
+      tree signed_ct = signed_type_for (ct);
       new_step = chrec_convert (signed_ct, new_step, at_stmt,
                                 use_overflow_semantics);
     }

        Jakub

Reply via email to