problems with call exit(code)


I’ve been having trouble with call(exit) using pgf90. This problem actually came up when trying to compile and set up a climate model, in which an exit code should be passed to the setup script to verify that an initial run has executed correctly. This initial run did execute correctly, but call exit(code) (where code as passed to exit is 13) always returns an exit code of 127 , which halts the setup script unnecessarily. There is an easy workaround in my case, but it would be bad form for future compilations.

I then wrote a basic script to see what call exit(13) would return. The code:

program test

  implicit none

  print *,"Make it work, please."

  call exit(13)

end program test

The output:

$ > pgf90 -o test.o test.f90
$ > ./test.o
Make it work, please.
$ > echo $?

So it appears that call exit conveys an exit code of 127 in this case as well. I’ve tried using export PGI_TERM=signal, but I haven’t had any luck. Any ideas?

For reference, I’m on an AMD-64 Linux machine with kernel 2.6.17-10.

Hi jw2519,

I asked our compiler team about this. While exit is not standard, we use to have this behavior where exit returned the requested status. However, when they put in better trace back support in the 6.2, they changed the behavior to return either “0” or non-zero. I’ve asked them to revisit this and see how they can add this support back.

  • Mat