gfortran does not allow character arrays with varying component lengths

You have some lengths 12 in the constructor, so it may be better to use length 12. Also, use instead character(len=12), dimension(5) :: models = [character(len=12) :: “feddes.swp”, & “jarvis89.swp”, “jarvis10.swp”, “pem.swp”, “van.swp”] Possibly even better, if you have compiler support, is character(len=*), dimension(*) :: …

What flags do you set for your GFORTRAN debugger/compiler to catch faulty code?

Bare minimum -Og/-O0 -O0 basically tells the compiler to make no optimisations. Optimiser can remove some local variables, merge some code blocks, etc. and as an outcome it can make debugging unpredictable. The price for -O0 option is very slow code execution, but starting from version 4.8 GCC compilers (including the Fortran one) accept a … Read more

What are the ways to pass a set of variable values through the subroutine to a function without common block?

What you care about here is association: you want to be able to associate entities in the function f with those in the subroutine condat. Storage association is one way to do this, which is what the common block is doing. There are other forms of association which can be useful. These are use association … Read more

How do I do big integers in Fortran?

There is no built-in “big number” support, but we can first check whether there is a larger integer kind available (as mentioned by Francescalus above and also many previous pages (e.g. this page). On my computer with gfortran-6.1, the compiler seems to support 128-bit integer kind, so I could calculate the result up to n=160 … Read more

What does “real*8” mean?

The 8 refers to the number of bytes that the data type uses. So a 32-bit integer is integer*4 along the same lines. A quick search found this guide to Fortran data types, which includes: The “real*4” statement specifies the variable names to be single precision 4-byte real numbers which has 7 digits of accuracy … Read more