[Bug fortran/66310] Problems with intrinsic repeat for large number of copies

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 18 02:00:00 GMT 2018


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

--- Comment #23 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Ok I see it.

In fbuf.c (fbuf_alloc):

      /* Round up to nearest multiple of the current buffer length.  */
      newlen = ((u->fbuf->pos + len) / u->fbuf->len + 1) *u->fbuf->len;
      u->fbuf->buf = xrealloc (u->fbuf->buf, newlen);
      u->fbuf->len = newlen;

We are rounding up to make sure we have enough buffer. The size newlen is
calculated to 2147484160 which exceeds the limit of 2147483647 and xrealloc
fails.


More information about the Gcc-bugs mailing list