If you have a gcc bugzilla account, add a comment to the exist bug with your example. The execution paths through gfortran for CLASS and "derive type" have significant overlap, so likely a patch the CLASS issue may also fix your issue.
Note, if you comment out the generic interface for "child", the code compiles and executes as expected. Interestingly, the Fortran standard permits this overloading of a structure constructor. -- steve On Sat, Feb 03, 2024 at 07:50:43AM -0500, John Haiducek wrote: > I've discovered an apparent bug in gfortran 13.2.1, which to me looks like > it could be a duplicate of an existing bug. I'm wondering if I should add a > comment to the existing bug with my MWE code, file a new bug and reference > the existing one as possibly related, or not file a bug since it's probably > a duplicate. > > Here's the details of the bug. The attached program produces a segmentation > fault in gfortran 13.2 and later but not in gfortran 11 or 12. From my own > experimentation and that of some community members on the fortran-lang > discourse, we determined that the following is required to trigger the > segmentation fault: > > - A child type inherits from a parent type, but adds no new data members > - The child type has a finalization procedure > - A variable of the child type is instantiated by calling a custom > constructor > > You can see the Discourse discussion on this at > https://fortran-lang.discourse.group/t/segmentation-fault-when-finalizing-an-inherited-type-with-custom-constructor/7319. > > > In the discussion it was pointed out that this might be related to > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110987. In light of that, I'm > wondering if it would be best to file a bug on this, or to *not* file a bug > since it's a likely duplicate of an existing bug. -- Steve