About 'error stop' statement

Angelo Graziosi angelo.graziosi@alice.it
Sun Aug 6 10:20:00 GMT 2017


Consider the following test case:

$ cat foo.f90
program foo
   implicit none
   print *, 'Hello...'
   error stop
   print *, '..world!'
end program foo

and compile with:

$ gfortran foo.f90

I get the following.

(1) on MSYS2 (Windows), gfortran-6.3.0

$ ./a.exe
  Hello...
ERROR STOP

Error termination. Backtrace:

Program received signal SIGSEGV: Segmentation fault - invalid memory 
reference.

Backtrace for this error:


(2) on MSYS2/MINGW64 (Windows), gfortran-7.1.0

$ ./a.exe
  Hello...
ERROR STOP

Error termination. Backtrace:

Could not print backtrace: libbacktrace could not find executable to open
#0  0xffffffff
#1  0xffffffff
#2  0xffffffff
#3  0xffffffff
#4  0xffffffff
#5  0xffffffff
#6  0xffffffff
#7  0xffffffff
#8  0xffffffff
#9  0xffffffff


(3) on MacPorts (macOS), gfortran 6.3.0

$ ./a.out
  Hello...
ERROR STOP

Error termination. Backtrace:
#0  0x10b907e46
#1  0x10b908718
#2  0x10b909326
#3  0x10b8ffe6a
#4  0x10b8ffea0


(4) on Windows Subsystem for Linux (Ubuntu 16.04.3 LTS), gfortran-5.4.0 
20160609

$ ./a.out
  Hello...
ERROR STOP

What is the right output? Sincerely, I don't understand WHY that output 
in (1), (2) and (3)...

Really in (1) it has to produce a Segm. Fault or BT in (2) and (3)?

Thanks,
    Angelo.



More information about the Fortran mailing list