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

            Bug ID: 128982
           Summary: [14/15/16/17 Regression] ICE at -O2 and above:
                    Segmentation fault in bitintlower (handle_lshift ->
                    integer_zerop on a null tree) at -O2 with
                    __builtin_add_overflow of a shifted _BitInt(129) into
                    _BitInt(192)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi,

$cat repro-small.c

unsigned f(unsigned a, unsigned b) {
  _BitInt(192) s = 0;
  int o = __builtin_add_overflow((_BitInt(129))a << 60, (_BitInt(129))b, &s);
  return (unsigned)(s & 0xffffffffu) + (unsigned)o;
}

$ gcc -O2 -c repro-small.c
during GIMPLE pass: bitintlower
repro-small.c: In function 'f':
repro-small.c:1:10: internal compiler error: Segmentation fault
0x2c3dccf internal_error(char const*, ...)
0x13ee24f crash_signal
0x17c1d27 location_wrapper_p(tree_node const*)


## Checked versions
- gcc trunk 1ed04a18ef6 (2026-11-24, --enable-checking=yes): ICE
- gcc 16.0.1 20260315 (Ubuntu): ICE
- gcc 15.2.0 (Ubuntu): ICE
- gcc 14.1.0 (Ubuntu): ICE
- gcc 13: compiles

Reproduced in Godbolt (gcc trunk, -O2): https://godbolt.org/z/94n5bP1d1

Thanks.

Reply via email to