[Patch fortran] PR84432 & PR114815 - test for non-conforming default PDT initializers

Harald Anlauf anlauf@gmx.de
Thu Sep 4 20:53:48 GMT 2025


Hi Paul!

Am 04.09.25 um 20:46 schrieb Paul Richard Thomas:
> Hi All,
> 
> PDT components with default initializers must have type parameter and
> length expressions that reduce to compile time integer constants. The chunk
> in expr.cc verifies that this is the case for array bounds and character
> lengths.
> 
> This error checking results in pdt_26.f03 segfaulting because, without a
> default initializer, the parameterized components are not allocated and it
> segfaults in runtime. The first chunk in trans-expr.cc fixes this. It has
> been checked for runtime memory leaks with valgrind. The whole point of
> pdt_27.f03 was to fix a problem with initialized, parameterized
> components(!), so it has been taken over to exercise the error checking.
> 
> Regtests on FC42/x86_64 - OK for mainline?

A minor nit: there is a double-space after %qs in

+	  gfc_error ("The component %qs  at %L of derived type %qs has "

Otherwise this looks good.

Thanks for the patch!

Harald

> Regards
> 
> Paul
> 



More information about the Fortran mailing list