Sun Studio 12: Fortran Library Reference


The isetjmp and longjmp routines are used to deal with errors and interrupts encountered in a low-level routine of a program. They are f95 intrinsics.

These routines should be used only as a last resort. They require discipline, and are not portable. Read the man page, setjmp(3V), for bugs and other details.

isetjmp saves the stack environment in env. It also saves the register environment.

longjmp restores the environment saved by the last call to isetjmp, and returns in such a way that execution continues as if the call to isetjmp had just returned the value ival.

The integer expression ival returned from isetjmp is zero if longjmp is not called, and nonzero if longjmp is called.

Example: Code fragment using isetjmp and longjmp:

       INTEGER*4  env(12)
       common /jmpblk/ env
       j = isetjmp( env )
       if ( j .eq. 0 ) then
               call  sbrtnA
          call error_processor
       end if
       subroutine sbrtnA
       INTEGER*4  env(12)
       common /jmpblk/ env
       call longjmp( env, ival )