gfortran

What is wrong with this Fortran '77 snippet?

I've been tasked with maintaing some legacy fortran code, and I'm having trouble getting it to compile with gfortran. I've written a fair amount of Fortran 95, but this is my first experience with Fortran 77. This snippet of code is the problematic one: CHARACTER*22 IFILE, OFILE IFILE='TEST.IN' OFILE='TEST.OUT' O...

i'm trying to solve an equation using gfortran but i keep getting error

i'm using the below program but i keep getting error.What is wrong with my progam? real x complex y real m1,H0,Ms,P1,P2,P3,w0,wm,wh complex w1,w2,o1,o2 integer i,n real pi n=4000000000 pi=4*atan(1.0) m1=4*pi*1e-7 H0=39.79e3 Ms=1400e3 P1=0.7*0.12 P2=0.3*0.12 P3=P1-P2 w0=m1*(1.76e11)*H0 wm=m1*(1.76e11)*Ms...

Fortran 77 debugger to check array bounds

I am still green to debugging F77 and am having some problems with array bounds. I recently modified a lengthy code to have new array sizes. Everything 'seemed' okay until I noticed methods to alter one array, altered another. Somewhere in this code, I assume, an assignment is out of bounds and writing to the other arrays. Is there a...

Howto resolve compiler specific runtime initialization functions for a library from the main application

What is the best practice when doing a mixed language library where the library language requires a runtime initialization? I have a problem where I'd like to create a certain library in Fortran which is to used from C++. I'd want to preserve platform independence and compiler independence if possible. Now, the two compilers I have play...

Are Fortran control characters (carriage control) still implemented in compilers?

In the book Fortran 95/2003 for Scientists and Engineers, there is much talk given to the importance of recognizing that the first column in a format statement is reserved for control characters. I've also seen control characters referred to as carriage control on the internet. To avoid confusion, by control characters, I refer to the c...

Mix GFortran/MSVC objects when linking: undefined reference to _chkstk

Trying to compile Xfoil and plotlib The fortran files are compiled with MinGW gfortran 4.5.0, and I compiled W32win.c with MSVC (2008/15.00). During linking with GCC I receive error: ../plotlib/libPlt.a(W32win.o):(.text+0x1469): undefined reference to `_chkstk' ../plotlib/libPlt.a(W32win.o):(.text+0x1509): undefined reference to `_c...

F77: problem to compile with g77 a program which was normally compiled with Absoft compiler

I am not a Fortran programmer (just a short experience), but I need to compile a program partly written in F77. Someone has compiled it with Absoft compiler before me, but now I need to repeat the procedure on another machine with g77. For Absoft, the makefile has f77 -f -w -O -B100 -B108 -c *.f mv *.f flib && mv *.o olib f77 -B100 -o...

Force explicit variable declaration with gfortran

I am linking some fortran code (f90) from matlab using mex and I am having matlab freeze occasionally. In the past, I had freezing happening due to mismatch between data types (say integer*4 vs integer*8). The code I am linking has many implicitly defined variables, so I am wondering if there is a hidden data type conflict that only o...

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

Hey you guys, i think i wont find that in any textbook, because answering this takes experience. i am currently in the stage of testing/validating my code / hunting bugs to get it into production state and any errors would lead to many people suffering e.g. the dark side. What kind of flags do you set when you compile your program fo...

Gfortran versions 4.1.2 and 4.2.3

Hey everybody, i am deploying my code from a cluster running on ubuntu onto a cluster with identical hardware, but with red hat and as it seems older gfortran compiler. The source is actually compiled by ifort, but since it is not installed on the red had cluster, i may have to switch to gfortran. Now the problem is that the code does ...

Turning off Hyper-Threading in 6-core Intel Xeon

We got a 12-core MacPro to do some Monte Carlo calculations. Its Intel Xeon processors have Hyper-Threading (HT) enabled, so in fact there should be 24 processes running in parallel to make them fully utilized. However, our calcs are more efficient to run on 12x100% than 24x50%, so we tried to turn Hyper-Threading off via Processor pane ...

Ifort suppress unused variable warning, leave all others intact

i use ifort and gfortran to compile my Fortran program. However i also use a coworkers source and he has got a lot of unused variables. How can i suppress these for the compile, seeing as they are not really an error? However i dont want to disable -pedantic and -stan in the compiler options and thus want all the other warnings. ch...

Why is this a function declared inside the module and then used somewhere else in the same module not seen by the linker?

I have a function (in case anyone is interested, it is this function) in a module that looks like this MODULE MYMODULE IMPLICIT NONE ! Some random stuff CONTAINS CHARACTER*255 FUNCTION strtok ( source_string, delimiters ) [...] END FUNCTION strtok SUBROUTINE DO_SOMETHING ( ) CHA...