The small attached source (100 lines) finish with segmental fault with the latest Mingw release (gcc version 7.2.0 (Rev1, Built by MSYS2 project) and did works very well with the previous version (gcc version 6.1.0 (x86_64-posix-seh, Built by MinGW-W64 project) .
I reduced the code source to the minimal size and when we reduce more the code turn normaly. we use in this code the latets oriented object specifications proposed with the 2003 fortran release.
I have a big load experience of Fortran bugs and i am sure that is a bug compiler because in the code source there is not any array, ni parameter mismath ni other instruction that usely causes bugs. Moreover ther are only five instructions between the start program and the segmental fault :
allocate (mate)
Call mate%Creer_situation_acier(1)
allocate (pt_situation)
pt_situation%m_pt_materiau => this
Call pt_situation%Set_Type_Situation_projet (type_situation)
The main instruction in cause in the bug is the pointer assignement in the routine Creer_situation_acier :
pt_situation%m_pt_materiau => this
and the segmentaion fault appears with the folower instruction :
Call pt_situation%Set_Type_Situation_projet (type_situation)
The compilation instruction is :
gfortran *.f90
the bug doesnot depends on the compilation options like optimisation level and degug level.
Thanks for your help.
This looks like a code generation issue in gcc itself. Looking at the assembly that was generated, it appears the vtbl function pointers aren't being set properly for the extension class. Please report this to the gcc bugzilla at https://gcc.gnu.org/bugzilla/, as the code generated is invalid on a linux machine as well (verified with
gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)