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

2020-08-07 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #21 from Susi Lehtola --- to repeat: libgfortran crashes when you try to read an environment variable that is an empty string, in the case you have preallocated an array that is the proper size i.e. zero characters. I don't get any m

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

2020-08-07 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #20 from Steve Kargl --- On Fri, Aug 07, 2020 at 01:14:04PM +, jussilehtola at fedoraproject dot org wrote: > > It already was reproduced in comment #9? > There is clearly a language barrier. At this point, I have no idea what

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

2020-08-07 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #19 from Susi Lehtola --- (In reply to Steve Kargl from comment #17) > On Thu, Aug 06, 2020 at 08:33:12PM +, jussilehtola at fedoraproject dot > org wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 > > > > --- Commen

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

2020-08-06 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #18 from kargl at gcc dot gnu.org --- Created attachment 49015 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49015&action=edit Bring get_environment_variable almost to F2018 conformance * check.c (gfc_check_get_environment_vari

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

2020-08-06 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #17 from Steve Kargl --- On Thu, Aug 06, 2020 at 08:33:12PM +, jussilehtola at fedoraproject dot org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 > > --- Comment #16 from Susi Lehtola --- > Yes, then I installed m

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

2020-08-06 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #16 from Susi Lehtola --- Yes, then I installed missing libgfortran debuginfos and the backtrace shortened to #0 0x401267 in zerolen_value at /tmp/readvar2.f90:17 #1 0x4012c4 in main at /tmp/readvar2.f90:22

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

2020-08-06 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #15 from Steve Kargl --- On Thu, Aug 06, 2020 at 08:42:20AM +, jussilehtola at fedoraproject dot org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 > > --- Comment #13 from Susi Lehtola --- > The gdb output is the s

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

2020-08-06 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #14 from Steve Kargl --- On Thu, Aug 06, 2020 at 08:03:29AM +, markeggleston at gcc dot gnu.org wrote: > (In reply to kargl from comment #6) > > I do note there are other problems with get_environment_variable. > > It looks to me

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

2020-08-06 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #13 from Susi Lehtola --- The gdb output is the same (gdb) r Starting program: /tmp/a.out Fortran runtime error: Zero-length string passed as value to get_environment_variable. Error termination. Backtrace: #0 0x401267 in zerolen_

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

2020-08-06 Thread markeggleston at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 markeggleston at gcc dot gnu.org changed: What|Removed |Added CC||markeggleston at gcc do

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

2020-08-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #11 from kargl at gcc dot gnu.org --- (In reply to Susi Lehtola from comment #10) > Compiled with -g, rerun gives > > $ ./a.out > Fortran runtime error: Zero-length string passed as value to > get_environment_variable. > > Error ter

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

2020-08-05 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #10 from Susi Lehtola --- Compiled with -g, rerun gives $ ./a.out Fortran runtime error: Zero-length string passed as value to get_environment_variable. Error termination. Backtrace: #0 0x401267 in zerolen_value at /tmp/re

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

2020-08-05 Thread kargl at gcc dot gnu.org
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:

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

2020-08-05 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #8 from Susi Lehtola --- (In reply to kargl from comment #5) > 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 una

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

2020-08-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #7 from kargl at gcc dot gnu.org --- (In reply to kargl from comment #6) > I do note there are other problems with get_environment_variable. > > 1) Neither length nor status can be integer(1). gfortran should issue >an error. >

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

2020-08-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #6 from kargl at gcc dot gnu.org --- I do note there are other problems with get_environment_variable. 1) Neither length nor status can be integer(1). gfortran should issue an error. 2) Fortran 2018 has added an optional errmsg a

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

2020-08-05 Thread kargl at gcc dot gnu.org
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

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

2020-08-05 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #4 from Susi Lehtola --- $ 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 ???

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

2020-08-05 Thread jussilehtola at fedoraproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #3 from Susi Lehtola --- program zerolen_value implicit none character(len=*), parameter :: name='HOSTNAME' character(len=:), allocatable :: value integer :: l, err call get_environment_variable(name,length=l,status=err) i

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

2020-08-05 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 Dominique d'Humieres changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED

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

2020-08-05 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 --- Comment #2 from Dominique d'Humieres --- Could you please provide an example?

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

2020-08-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96486 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- C