2025-09-26 Harald Anlauf <anlauf@gcc.gnu.org>
gcc/fortran
PR fortran/122002
* decl.cc (gfc_get_pdt_instance): Initialize 'instance' to NULL
and set 'kind_value' to zero before calling gfc_extract_int.
* primary.cc (gfc_match_rvalue): Intitialize 'ctr_arglist' to
NULL and test for default values if gfc_get_pdt_instance
returns NULL.
/* The symbol for the parameter in the template f2k_namespace. */
gfc_symbol *param;
/* The hoped for instance of the PDT. */
- gfc_symbol *instance;
+ gfc_symbol *instance = NULL;
/* The list of parameters appearing in the PDT declaration. */
gfc_formal_arglist *type_param_name_list;
/* Used to store the parameter specification list during recursive calls. */
goto error_return;
}
+ kind_value = 0;
gfc_extract_int (kind_expr, &kind_value);
sprintf (name + strlen (name), "_%d", kind_value);
{
gfc_symtree *pdt_st;
gfc_symbol *pdt_sym;
- gfc_actual_arglist *ctr_arglist, *tmp;
+ gfc_actual_arglist *ctr_arglist = NULL, *tmp;
gfc_component *c;
/* Obtain the template. */
first argument list and return the parameter list in
ctr_arglist. */
m = gfc_get_pdt_instance (actual_arglist, &pdt_sym, &ctr_arglist);
- if (m != MATCH_YES)
+ if (m != MATCH_YES || !ctr_arglist)
{
if (ctr_arglist)
gfc_free_actual_arglist (ctr_arglist);