Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29062 Discussions

ifx return value of execute_system_command different than ifort

Masoud
Beginner
502 Views

I am not sure if I am doing something wrong or if this is a bug in ifx. I recently started compiling with ifx following the recommendations. A new error appeared and after some debugging I got to this. I am just decompressing a file with `execute_system_command` and reading it. But depending on what I compile it I get different values on existStat of this subroutine.

program nmwe
    implicit none
    integer :: iun, estat, val
    character(len=6), parameter :: fcompressed = "foo.gz"
    character(len=3), parameter :: fname = "foo"
    character(len=14), parameter :: command = "gzip -d foo.gz"
    logical :: fexist
    print*, "calling system command to decompress"
    call execute_command_line(command, exitstat = estat)
    inquire(file = fname, exist = fexist)
    if (fexist) then
        print*, "apparently decompression was successful"
        open(newunit = iun, file = fname)
        read(iun, *) val
        print*, "value is ", val
        close(iun)
    else
        print*, "file was not decompressed"
    end if
    if (estat /= 0) then
        print*, "But there was a problem in `", command, "`!!!"
    end if
end program nmwe

And here is the output. 

Screenshot 2024-08-12 at 12.29.41.png

0 Kudos
1 Solution
TobiasK
Moderator
453 Views

@Masoud


I cannot reproduce your problem using 2024.2. Which version are you using?




View solution in original post

0 Kudos
2 Replies
TobiasK
Moderator
454 Views

@Masoud


I cannot reproduce your problem using 2024.2. Which version are you using?




0 Kudos
Masoud
Beginner
448 Views

Thanks @TobiasK for checking this. I just noticed I was using 2021.1 Beta 20201113. Our cluster admin has made this the default intel compiler and I never noticed I am using a beta version. Used 2024 and the problem is now solved.

Reply