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

            Bug ID: 128878
           Summary: [17 Regression] ICE at -O3 in exact_div, at
                    poly-int.h:2179 during GIMPLE pass linterchange
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi,

The following valid testcase ICEs at -O3 (fine at -O0, -O1, -O2, -Os):

$ cat repro.c

struct a { _BitInt(35) x : 6; _BitInt(575) b : 455; };
void c (struct a *);

void d (void)
{
  struct a e[5];
  for (int f = 0; f < 5; f++)
    e[f].b = 0;
  c (e);
}

$ gcc-trunk -c -O3 repro.c
during GIMPLE pass: linterchange
repro.c: In function ā€˜d’:
repro.c:4:6: internal compiler error: in exact_div, at poly-int.h:2179
    4 | void d (void)
      |      ^
0x2b5ea8f internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0xb2d847 fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1813
0x953a11 poly_int<1u, poly_result<long, if_nonpoly<int, int,
poly_int_traits<int>::is_poly>::type, poly_coeff_pair_traits<long,
if_nonpoly<int, int, poly_int_traits<int>::is_poly>::type>::result_kind>::type>
exact_div<1u, long, int>(poly_int<1u, long> const&, int)
        ../../gcc/poly-int.h:2179
0x953a11 poly_int<1u, poly_result<long, if_nonpoly<int, int,
poly_int_traits<int>::is_poly>::type, poly_coeff_pair_traits<long,
if_nonpoly<int, int, poly_int_traits<int>::is_poly>::type>::result_kind>::type>
exact_div<1u, long, int>(poly_int<1u, long> const&, int)
        ../../gcc/poly-int.h:2173
0x953a11 interpret_rhs_expr
        ../../gcc/tree-scalar-evolution.cc:1847
0x1486551 interpret_expr
        ../../gcc/tree-scalar-evolution.cc:2081
0x1486551 analyze_scalar_evolution_1
        ../../gcc/tree-scalar-evolution.cc:2117
0x148713d analyze_scalar_evolution(loop*, tree_node*, tree_node**)
        ../../gcc/tree-scalar-evolution.cc:2220
0x28b03f4 compute_access_stride
        ../../gcc/gimple-loop-interchange.cc:1327
0x28b03f4 compute_access_strides
        ../../gcc/gimple-loop-interchange.cc:1385
0x28b03f4 prepare_perfect_loop_nest
        ../../gcc/gimple-loop-interchange.cc:2041
0x28b03f4 execute
        ../../gcc/gimple-loop-interchange.cc:2099
0x28b03f4 execute
        ../../gcc/gimple-loop-interchange.cc:2088
/home/haoxin/research/gcc/build/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu repro.c -quiet -dumpbase repro.c
-dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -o /tmp/ccvpzBg0.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

It seems to occur only in the trunk version (GCC 17).

Reproduced in Godbolt: https://godbolt.org/z/rEGerdhPj

Thanks.

Reply via email to