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

--- Comment #9 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #5)
> (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.

Whoops.  Misread part of bug report. With tcsh, I see

% setenv HOSTNAME ''
% gfcx -o z -g -O b.f90 && ./z
Fortran runtime error: Zero-length string passed as value to
get_environment_variable.

and

unsetenv HOSTNAME
% setenv HOSTNAME
% gfcx -o z -g -O b.f90 && ./z
Fortran runtime error: Zero-length string passed as value to
get_environment_variable.

No backtrace.  Can you compile with -g, run the executable under gdb,
and post the backtrace.

Reply via email to