https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486
--- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Mark Eggleston <markeggles...@gcc.gnu.org>: https://gcc.gnu.org/g:5effbd0733f9a4d42ddae965e4c28701be7811ac commit r10-8658-g5effbd0733f9a4d42ddae965e4c28701be7811ac Author: Mark Eggleston <markeggles...@gcc.gnu.org> Date: Mon Aug 10 08:07:39 2020 +0100 Fortran : get_environment_variable runtime error PR96486 Runtime error occurs when the type of the value argument is character(0): "Zero-length string passed as value...". The status argument, intent(out), will contain -1 if the value of the environment is too large to fit in the value argument, this is the case if the type is character(0) so there is no reason to produce a runtime error if the value argument is zero length. 2020-08-24 Mark Eggleston <markeggles...@gcc.gnu.org> libgfortran/ PR fortran/96486 * intrinsics/env.c: If value_len is > 0 blank the string. Copy the result only if its length is > 0. 2020-08-24 Mark Eggleston <markeggles...@gcc.gnu.org> gcc/testsuite/ PR fortran/96486 * gfortran.dg/pr96486.f90: New test. (cherry picked from commit de09e7ebc9d5555653745a103eef2b20c7f1dd76)