http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61035
Bug ID: 61035 Summary: Crash in getcwd intrinsic due to stack overflow Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: jb at gcc dot gnu.org The example program below crashes (my stack size limit is 8 MiB). program getcwd_overflow implicit none character(len=10485760) :: str ! 10 MiB call getcwd(str) print *, trim(str) end program getcwd_overflow The reason is that in libgfortran/intrinsics/getcwd.c we try to allocate space for a NULL-terminated duplicate of the string on the stack.