Hi
I have programmed Fortran for almost 40 years, mainly in materials thermodynamics, and since a retired a few years ago I started to use the new Fortran standard with TYPE etc to write a free version a thermodynamcs software based on my previous experiences. This has now grown to become some 40000 lines but it can calculate very nice things like multicomponent equilibria, phase diagrams etc. The software has worked quite well until last week when I added a few new facilities and suddenly got a lot of "Segmentation faults" running my test files. I know this is an error which is hard to trace but I do not think I can arrange a simpler version of the program where the error ocuurs. But as the sofware is free I can send a version to anyone who is interested and has a lot of free time to try to help.
The error occurs both occationally (the same calculculation sometimes work, sometimes fails) but always in some circumstances, in particular when I try to deallocate arrays of TYPE defined structures (containing other allocatable arrays). I know I have a rather complex data structure and rather involved code but what you can do with thermodynamics can also be quite complex. The case where it (almost) always fails it is when deallocationg such an allocatable array containing other allocatable arrays. The deallocation does not fail when I have used only the first element of this array of structures. But I sometimes get the error in other parts of the software when doing plain calculations, not deallocating anything.
I use GNU Fortran version 4.8 on Windows.
Any hint how I could rearrange the data structure to be more stable is welcome. I can attach a zip file with the code if there is interest, an earlier version of the software is available on the opencalphad repository on github. That never had this error.
Best wishes
Bosse
I have programmed Fortran for almost 40 years, mainly in materials thermodynamics, and since a retired a few years ago I started to use the new Fortran standard with TYPE etc to write a free version a thermodynamcs software based on my previous experiences. This has now grown to become some 40000 lines but it can calculate very nice things like multicomponent equilibria, phase diagrams etc. The software has worked quite well until last week when I added a few new facilities and suddenly got a lot of "Segmentation faults" running my test files. I know this is an error which is hard to trace but I do not think I can arrange a simpler version of the program where the error ocuurs. But as the sofware is free I can send a version to anyone who is interested and has a lot of free time to try to help.
The error occurs both occationally (the same calculculation sometimes work, sometimes fails) but always in some circumstances, in particular when I try to deallocate arrays of TYPE defined structures (containing other allocatable arrays). I know I have a rather complex data structure and rather involved code but what you can do with thermodynamics can also be quite complex. The case where it (almost) always fails it is when deallocationg such an allocatable array containing other allocatable arrays. The deallocation does not fail when I have used only the first element of this array of structures. But I sometimes get the error in other parts of the software when doing plain calculations, not deallocating anything.
I use GNU Fortran version 4.8 on Windows.
Any hint how I could rearrange the data structure to be more stable is welcome. I can attach a zip file with the code if there is interest, an earlier version of the software is available on the opencalphad repository on github. That never had this error.
Best wishes
Bosse