Compilation mistake
I have been trying to use Tough2 version 2.1 in Windows 7 (64 bit) but it hasn’t worked. I am using the commands
gfortran -c -O2 -fdefault-real-8 -fno-align-commons -fdefault-double-8 -funroll-loops t2fm.f t2cg22n.f EOS3.F t2f.f meshm.f t2solv.f ma28.f T2
gfortran -O2 -fdefault-real-8 -fno-align-commons -fdefault-double-8 -funroll-loops -static -o tough2_3 t2cg22n.o meshm.o EOS3.o t2f.o ma28.o t2solv.o t2fm.o T2
and also I’ve used it without the command -funroll-loops. The .exe is ok, but when I solved the file SAM1 with the MESH and INCON outside the input it shows mistake (program received signal SIGSEV:segmentation fault-invalid memory reference). I mean I haven’t been able to solve problems with a MESH outside the input file. I’m using gfortran with the free compiler MINGW.
I send you the file that I'm using without the MESH and INCON inside.
Any clue??
5 replies
-
Try to reduce the optimization from -O2 to -O0.
-
It didn't work.
-
Which version of gfortran? Try v6.
-
Try to compile with -g to see where the seg fault comes from.
-
Compile as you do, but add -ggdb3 to the list of options (to both compile and link). Then run it like this:
gdb -q -batch -ex r -ex bt --args tough2_3
This will launch the program in the debugger, instructing it to run and then to print a back-trace once the program crashes. Hopefully, the source line that performs the memory access will provide some clue to what is wrong.