On 10/12/26 8:14 AM, Paul Richard Thomas wrote:
Hello Jerry,
After some thought and a review by Claude, I am resubmitting a rather
more elaborate version of bug1.patch. Please find the replacement
attached.
The first chunk replaces a call to
gfc_pdt_find_component_copy_initializer with one to gfc_simplify_len.
This allows the simplification of a far wider range of parameterized
string length expressions.
The prototype for gfc_simplify_len has to be added to gfortran.h of
course. I tried to avoid this by using gfc_build_intrinsic_call and
simplifying the call expression. For some reason that I couldn't see,
this produced perfectly OK code that did not simplify, resulting in
pdt_33.f03 regressing. I will make one last attempt to get this
version to work before pushing the attached.
Most of the patch tidies up the original code in gfc_simplify_len,
making it considerably more comprehensible. The second half is a more
hygienic fix for pdt_bug1 in that a result is returned for length
expressions, which after parameter replacement, simplify to a constant
expression.
The patch passes regression testing on FC44/x86_64 - OK for mainline?
Paul
OK, looks good to me.
Jerry
---------- Forwarded message ---------
From: Jerry D <[email protected]>
Date: Thu, 8 Oct 2026 at 20:03
Subject: Re: [Patch, fortran] (1/16) 82173 Parameterized derived type
errors comment #10
To: Paul Richard Thomas <[email protected]>,
[email protected] <[email protected]>, gcc-patches
<[email protected]>
On 10/8/26 5:31 AM, Paul Richard Thomas wrote:
bug1-simplify-len-ice.f90 fails in compilation with:
f951: internal compiler error: Segmentation fault
0x276485f internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:787
0xfa57cf crash_signal
../../gcc/gcc/toplev.cc:325
0x81decb gfc_simplify_len(gfc_expr*, gfc_expr*)
../../gcc/gcc/fortran/simplify.cc:5085
0x76a949 do_simplify
../../gcc/gcc/fortran/intrinsic.cc:5002
The attached tidies up the appearance of the code around the fix and
punts on null symtrees.
Passes regtesting on FC44/x86_64. OK for mainline.
Cheers
Paul
This one looks good to go.
Thanks,
Jerry