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

            Bug ID: 127475
           Summary: vect: Induction ICEs building mask-type constants
           Product: gcc
           Version: 15.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rdapp at gcc dot gnu.org
  Target Milestone: ---
            Target: i386

This is the issue I noticed with the scalar-evolution patches.  I had some
difficulties narrowing it down but "AI" was a big help in writing a test case
that ICEs on x86.

A gimple reproducer is:

typedef _Bool bool8 __attribute__((signed_bool_precision(8)));

void __GIMPLE (ssa)
f (unsigned char * restrict a, int n)
{
  int i;
  bool8 j;
  unsigned char _31;
  unsigned long _32;
  unsigned char * _33;

  __BB(2):
  if (n_2(D) > 0)
    goto __BB3;
  else
    goto __BB5;

  __BB(3):
  i_10 = __PHI (__BB2: 0, __BB4: i_11);
  j_20 = __PHI (__BB2: _Literal (bool8) 0, __BB4: j_21);
  _31 = (unsigned char) j_20;
  _32 = (unsigned long) i_10;
  _33 = a_1(D) + _32;
  __MEM <unsigned char> (_33) = _31;
  j_21 = j_20 + _Literal (bool8) 1;
  i_11 = i_10 + 1;
  if (i_11 < n_2(D))
    goto __BB4;
  else
    goto __BB5;

  __BB(4):
  goto __BB3;

  __BB(5):
  return;
}

ICEs on x86 with -O2 -msse -fgimple.  Can be reproduced with GCC 15.3.

during RTL pass: expand
bool8-induction.c: In function ‘f’:
bool8-induction.c:23:1: internal compiler error: in
const_vector_mask_from_tree, at expr.cc:14172
   23 | f (unsigned char * restrict a, int n)
      | ^

We're building a const vector from a mask-typed induction variable {1, 2, 3,
...}.  This only triggers on targets where the mask type is mapped to a
character type.

Reply via email to