Differences between F77 and F90 code

Hello, I had to port a Fortran code from Fortran 77 to Fortran 90. The only real change made to the code is that arrays now are dynamically allocated. I am running now the two codes in parallel to check that the new code is working as the old one. My problem is that the two codes do not produce the same results. In particular, at one point two variables with the same exact value are summed and the result in the two codes are different. The differences is in the last digit, in the order of macheps, but that difference propagates through the code. Is there any particular reason for that behavior? All the optimizations have been turned off and the code works with single precision variables.

Note: I’ve compiled and run the code with the Intel fortran compiler and the two codes produce the exact same results.

Thanks in advance for your time,

Sara

Hi Sara,

All the optimizations have been turned off and the code works with single precision variables.

Do you mean that you just removed all the optimization flags or did you use “-O0”? The default is to use “-O” when no flags are present, so you do need to add “-O0” in order to disable optimization.

If it persists at “-O0”, my best guess is that some array isn’t initialized, you have an out-of-bounds error, or some other type of memory issue. I would try running the code under Valgrind (www.valgrind.org) to see what it says. You could also try adding bounds checking (-Mbounds).

Hope this helps,
Mat