[PATCH] Fortran : get_environment_variable runtime error PR96486

Mark Eggleston mark.eggleston@codethink.co.uk
Mon Aug 17 07:34:05 GMT 2020


Please find attached a fix for PR96486.

OK to commit?

[PATCH] 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-17  Mark Eggleston <markeggleston@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-17  Mark Eggleston <markeggleston@gcc.gnu.org>

gcc/testsuite/

     PR fortran/96486
     * gfortran.dg/pr96486.f90

-- 
https://www.codethink.co.uk/privacy.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-get_environment_variable-runtime-error-PR964.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200817/d77d0d5e/attachment.bin>


More information about the Gcc-patches mailing list