- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that the get_environment_variable subroutine has a bug
bash-4.1$ uname -a Linux mars 2.6.32-696.18.7.el6.x86_64 #1 SMP Thu Jan 4 17:31:22 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux bash-4.1$ /opt/intel/bin/ifort -v ifort version 16.0.0 bash-4.1$ cat test.f90 program test integer :: v call get_environment_variable ("TG_NO_HE5_OUTPUT", status=v) write (*,*) 'status=', v end program bash-4.1$ /opt/intel/bin/ifort -w ./test.f90 bash-4.1$ TG_NO_HE5_OUTPUT= ./a.out status= 1 bash-4.1$ TG_NO_HE5_OUTPUT=foo ./a.out status= 0
The documentation for get_environment_variable suggests that status=0 should be returned for both cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tend to agree with you that "exists but has no value" should return a status of zero. Please report this to the Online Service Center.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've rewritten this response four times already...
I guess there is some ambiguity regarding whether the variable exists with no value, or doesn't exist, in the first case. I note that F2018 adds words " or the VALUE argument is not present" to the zero case - F2008 doesn't say that.
I am not a bash expert, but the documentation I can find suggests that "unset" is needed to make the variable not exist at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please consider the following:
bash-4.1$ TG_NO_HE5_OUTPUT= printenv | grep TG_NO_HE5_OUTPUT TG_NO_HE5_OUTPUT=
This shows that the variable exists but has no value, or equivalently, has the value of the empty string "".
Also, here is the C equivalent:
bash-4.1$ cat t.c #include#include int main (int argc, char **argv) { (void) argc; (void)argv; (void) fprintf (stdout, "status = %d\n", (NULL == getenv ("TG_NO_HE5_OUTPUT"))); return 0; } bash-4.1$ gcc -W -Wall t.c bash-4.1$ ./a.out status = 1 bash-4.1$ TG_NO_HE5_OUTPUT= ./a.out status = 0 bash-4.1$ TG_NO_HE5_OUTPUT=foo ./a.out status = 0
This also shows that an environment variable can exist with no value.
Thanks, --John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tend to agree with you that "exists but has no value" should return a status of zero. Please report this to the Online Service Center.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, John, please submit a bug report via https://supporttickets.intel.com/?lang=en-US . We appreciate your taking your time in reporting this.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page