[Bug fortran/96486] get_environment_variable crashes for environment variables that are empty strings
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Fri Aug 7 22:13:46 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486
--- Comment #26 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Aug 07, 2020 at 09:55:06PM +0000, schwab@linux-m68k.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486
>
> --- Comment #25 from Andreas Schwab <schwab@linux-m68k.org> ---
> But why does it error out? It shouldn't!
>
You'll have to ask Paul Brook why he chose to issue an error.
% svn annotate libgfortran/intrinsic/env.c
...
85656 pbrook if (value != NULL)
85656 pbrook {
85656 pbrook if (value_len < 1)
85656 pbrook runtime_error ("Zero-length string passed as value to "
85656 pbrook "get_environment_variable.");
85656 pbrook else
85656 pbrook memset (value, ' ', value_len); /* Blank the string.
*/
85656 pbrook }
IIRC, r85656 is tree-ssa becoming pre-gcc 4.0.0.
More information about the Gcc-bugs
mailing list