Re: [Patch, fortran] PR112460 - [PDT] ICE with parameterized derived types (incorrect code, should be rejected)

Steve Kargl <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
On Sun, Jan 11, 2026 at 01:41:30PM +0000, Paul Richard Thomas wrote:
> 
> This patch detects mismatched, constant PDT type specification parameters
> in array constructors and assignment. It is completely straightforward and
> sufficiently described by the ChangeLog.
> 
> In preparing the testcase, I noticed that assignment of one PDT variable
> array to another was not being scalarized but, instead being copied
> directly. While this is OK for PDTs with no len parameters, parameterized
> arrays or strings, it is not generally correct. The fix is the one-liner in
> trans-expr.cc.
> 
> Regtests on FC43/x86_64 - OK for mainline?
> 

Looks good to me with one nit below.

>  
> +/* Functions to check constant valued type specification parameters.  */
> +
> +static gfc_actual_arglist *
> +get_parm_list_from_expr (gfc_expr *expr)
> +{

(snip)

> +}
> +
> +bool
> +gfc_check_type_spec_parms (gfc_expr *expr1, gfc_expr *expr2,
> +			   const char *context)
> +{

(snip)

> +}


Sandra pointed out in another PR that GCC (documentation) 
guide lines require a comment before a function that 
explains what the function does.  In this case, something
as simple as 

/* Check that expr1 and expr2 are constant expressions
   and the types of the expressions match.  */

or some such words.

PS: yes, I'm guilty of not documenting a number of functions.


-- 
Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.