https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66310
Bug ID: 66310 Summary: Problems with intrinsic repeat for large number of copies Product: gcc Version: 5.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gerhard.steinmetz.fort...@t-online.de Target Milestone: --- This small program compiles without any message (gfortran 5.1.1, 4.9.0, 4.8.3) program p character :: z = 'z' print *, repeat(z, huge(1_4)) end but running the binary ./a.out yields (e.g. with 5.1.1 on SUSE Linux 13.2, 64 bit) : Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Adding a parameter attribute to above source, program p character, parameter :: z = 'z' print *, repeat(z, huge(1_4)) end then compilation aborts with : f951: out of memory allocating 18446744065119617024 bytes after a total of 425984 bytes The requested memory is about 2^64 bytes and much too large. huge(1_4) is 2147483647. Remarks : The relevant ulimits of the system were unlimited. The amount of free RAM was much larger than 2 GB.