https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77880
--- Comment #2 from Bernd Schmidt <bernds at gcc dot gnu.org> --- Hmm, a memcmp with ULONG_MAX as the size. Try this? Index: expr.c =================================================================== --- expr.c (revision 240429) +++ expr.c (working copy) @@ -785,7 +785,7 @@ by_pieces_ninsns (unsigned HOST_WIDE_INT case COMPARE_BY_PIECES: int batch = targetm.compare_by_pieces_branch_ratio (mode); int batch_ops = 4 * batch - 1; - int full = n_pieces / batch; + unsigned HOST_WIDE_INT full = n_pieces / batch; n_insns += full * batch_ops; if (n_pieces % batch != 0) n_insns++;