Topic: Newbee: how to cope with SIGSEGV

I'm new to this Fortan Environment - back to this language after years...
I'm currently transferring a Fortran progam to JS (ExtendScript used by Adobe) and had a problem to get wrong results in my 'translated' program. To find the error in my 'translation' i installed SF:

  • I preceeded the subroutine I got from a physicist by a short test program

  • When compiling (Build > Compile and Run) I get the message «Program received signal SIGSEGV: Segmentation fault - invalid memory reference.»

  • I tried hard (including research in this forum) but did not find a reason for this.

  • Abandoning the first subroutine (there is a second one called by the first) and integrating it into the test pgm worked.

  • So i could find why my JavaScript version did not create correct results.

I want to use Simply Fortran for more projects (I have not yet purchased) and hence need to understand what's going on with this error.

The program is not long. You may have a look at http://daube.ch/zz_tests/QSimpson.for

Any ideas are welcome

PS: Don't flame the progammer! The programming style is awkward: I have not yet re-learned the syntax and rules of newer fortran versions (I'm 75) - in particular not which version is used in SF - and my colleagues routine obviously is Fortran 66 style...

Re: Newbee: how to cope with SIGSEGV

I downloaded and ran your code, and I do indeed receive the segmentation fault.  If you run your code via our debugger, you'll see that the program fails on line 76:

PAR=-1

I'm guessing the program crashes for a combination of reasons:

  1. You're calling the AREA subroutine without an interface

  2. You're attempting to assign a value to a passed parameter

I think the code fails because the calling program does not have any knowledge of the subroutine, and the subsequent write to the PAR variable is problematic.  I'm not sure why the code bothers to reassign an input value that seems to be a flag, but regardless...

If you comment out that code, it will fail later on line 17:

      Write (*, 9991) INTEGRAL

The format string expects a whole list of values to be passed, but your code is passing only a single value.  It should work if you change it solely to:

      Write (*, *) INTEGRAL

With that change, though, the code still basically outputs zero as your integral.  I suspect something is still wrong.

EDIT: Looking at the code, I guess it isn't wrong.  It appears to be computing the area under a sine wave, which correctly sums to zero.

Jeff Armstrong
Approximatrix, LLC