http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53521
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-30 13:49:51 UTC --- That is clearly a bug in the Fortran FE. D.1888 = (integer(kind=4)[0] * restrict) __builtin_realloc ((void *) atmp.0.data, D.1887); if (D.1888 == 0B && D.1887 != 0) { _gfortran_os_error (&"Allocation would exceed memory limit"[1]{lb: 1 sz: 1}); } if (D.1887 == 0) { D.1888 = 0B; } means that D.1888 isn't freed. POSIX says that realloc (x, 0) acts as free only if x is not NULL, realloc (NULL, 0) acts as malloc (0), which can either return NULL, or a unique pointer that needs to be freed.