[Bug fortran/96486] get_environment_variable fails for zero-length values

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 5 17:36:35 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|WAITING                     |NEW

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to Susi Lehtola from comment #4)
> $ export HOSTNAME=foo
> $ ./a.out 
> $
> 
> $ export HOSTNAME=
> $ ./a.out 
> Fortran runtime error: Zero-length string passed as value to
> get_environment_variable.
> 
> Error termination. Backtrace:
> #0  0x7f25c93aadf1 in ???
> #1  0x7f25c93ab939 in ???
> #2  0x7f25c93abe60 in ???
> #3  0x7f25c960ce53 in ???
> #4  0x401267 in ???
> #5  0x4012c4 in ???
> #6  0x7f25c903a041 in __libc_start_main
> 	at ../csu/libc-start.c:308
> #7  0x4010ad in ???
> #8  0xffffffffffffffff in ???
> $

Thanks.

What gfortran version and operating system?  I get

% gfcx -o z b.f90 && ./z
STOP System variable unassigned
% gfcx -o z -g b.f90 && ./z
STOP System variable unassigned
% gfcx -o z -g -O b.f90 && ./z
STOP System variable unassigned

with your code where gfcx is gfortran 10.0.0 (Jan 2020 vintage)
and I'm using i585-*-freebsd.


More information about the Gcc-bugs mailing list