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

            Bug ID: 126505
           Summary: [17 Regression] ICE in decompose, at wide-int.h:1049
                    with saturation pattern
           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: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

signed char a (int x)
{
  if ((unsigned long long) x + 128ull > 255ull)
    return (signed char) (-(signed char) (x < 0) ^ 127);
  return (signed char) x;
}

signed char b (short x)
{
  if ((unsigned int) x + 128u > 255u)
    return (signed char) (-(signed char) (x < 0) ^ 127);
  return (signed char) x;
}

short c (int x)
{
  if ((unsigned long long) x + 32768ull > 65535ull)
    return (short) (-(short) (x < 0) ^ 32767);
  return (short) x;
}

signed char d (long long x)
{
  if ((unsigned int) x + 128u > 255u)
    return (signed char) (-(signed char) (x < 0) ^ 127);
  return (signed char) x;
}

ICEs at -O2 on aarch64:
uring GIMPLE pass: widening_mul
<source>: In function 'a':
<source>:1:13: internal compiler error: in decompose, at wide-int.h:1049
    1 | signed char a (int x)
      |

Reply via email to