[Bug target/124436] "cc1: out of memory allocating 18446744065119617032 bytes after a total of 1380352 bytes" with --param=min-nondebug-insn-uid=1073741824

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 10 19:05:53 GMT 2026


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
static void
dfa_insn_code_enlarge (int uid)
{
  int i = dfa_insn_codes_length;
  dfa_insn_codes_length = 2 * uid;
  dfa_insn_codes = XRESIZEVEC (int, dfa_insn_codes,
                 dfa_insn_codes_length);
  for (; i < dfa_insn_codes_length; i++)
    dfa_insn_codes[i] = -1;
}

So, already when uid is 1 << 30 or larger, 2 * uid will overflow.
As no INSN_UID can be larger than INT_MAX and when that wraps around, all bets
are off,
perhaps we just want
  dfa_insn_codes_length = MIN (INT_MAX, HOST_WIDE_INT_C (2) * uid);
or so?


More information about the Gcc-bugs mailing list