Silverfrost Forums

Welcome to our forums

Bug with 64 bit compiler

28 Dec 2025 11:41 #32610

The code at the link below runs as expected with the FTN95 64 bit compiler returning results identical to two other compilers.

Now, if the whole module betainv_storage is commented out FTN95 64 continues to return the expected results, even although the variables g_p64, g_alpha64, g_beta64 are never defined anywhere. Other compilers correctly fault the code.

What is interesting, is if you step through the code in the debugger, before the function brent01D is called, you can see that g_p64, g_alpha64, g_beta64 exist as real*8 variables!

I was very confused by this, then found that the 32 bit compiler correctly faults the code when the module betainv_storage is commented out.

An accidental discovery, I changed the name of the storage module, forgot to change the USE statements – and found the code still ran!

https://www.dropbox.com/scl/fi/zx9gptbl3410ax5jhaeqt/problemf95.f95?rlkey=bavxm914syry57dllfq7hhnpm&st=57sbzmqi&dl=0

28 Dec 2025 3:26 #32611

I suspect that the strange behaviour that Kenneth notes is related to the .MOD files generated by the compiler. If such a file has been produced by a previous compilation, the compiler may find and use it even if it has become stale/invalid by changes to the source file in which the module is declared and defined. It is also possible that the .MOD files are the same regardless of whether or not the /64 option is specified.

Such issues are often troublesome when makefiles are used for building a complex DLL such as for Slatec or NSWC. I have been in confusing situations where some .OBJ files with 32-bit code that were created earlier are overwritten by newer .OBJ files with 64-bit code, and the linker asks me for help.

28 Dec 2025 4:10 #32612

Mecej4,

Thank you, your suspicions were 100% correct! If I delete the old mod file I get the expected/correct behaviour.

28 Dec 2025 5:34 #32613

Kenneth, thanks for following up and reporting. I did some more checking with your code, and I am pleased to note that FTN95 uses a different suffix for module files when /64 is used for compilation: the suffix is .MOD64, whereas a 32-bit compilation produces a moule file with the suffix .MOD . This difference could be helpful when writing makefile rules.

Please login to reply.