Hi! First of all, many thanks for the patch! If i may, i have a question concerning the chosen style in the error message and one nitpick concerning a return type though, the latter primarily prompting this reply.
On Tue, 20 Jun 2023 11:54:25 +0100 Paul Richard Thomas via Fortran <fort...@gcc.gnu.org> wrote: > diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc > index d5cfbe0cc55..c960dfeabd9 100644 > --- a/gcc/fortran/expr.cc > +++ b/gcc/fortran/expr.cc > @@ -6470,6 +6480,22 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, > bool alloc_obj, > } > return false; > } > + else if (context && gfc_is_ptr_fcn (assoc->target)) > + { > + if (!gfc_notify_std (GFC_STD_F2018, "%qs at %L associated to " > + "pointer function target being used in a " > + "variable definition context (%s)", name, > + &e->where, context)) I'm curious why you decided to put context in braces and not simply use quotes as per %qs? > + return false; > + else if (gfc_has_vector_index (e)) > + { > + gfc_error ("%qs at %L associated to vector-indexed target" > + " cannot be used in a variable definition" > + " context (%s)", > + name, &e->where, context); Ditto. > diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc > index e7be7fddc64..0e4b5440393 100644 > --- a/gcc/fortran/match.cc > +++ b/gcc/fortran/match.cc > @@ -6377,6 +6377,39 @@ build_class_sym: > } > > > +/* Build the associate name */ > +static int > +build_associate_name (const char *name, gfc_expr **e1, gfc_expr **e2) > +{ > + return 1; > + return 0; > +} I've gone through the frontend recently and changed several such boolean functions to use bool where appropriate. May i ask folks to use narrower types in new code, please? Iff later in the pipeline it is considered appropriate or benefical to promote types, these will eventually be promoted. > diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc > index e6a4337c0d2..18589e17843 100644 > --- a/gcc/fortran/trans-decl.cc > +++ b/gcc/fortran/trans-decl.cc > @@ -1906,6 +1915,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) > gcc_assert (!sym->value || sym->value->expr_type == EXPR_NULL); > } > > + ISTM that the addition of vertical whitespace like here is in contradiction with the coding style. Please kindly excuse my comment and, again, thanks! > gfc_finish_var_decl (decl, sym); > > if (sym->ts.type == BT_CHARACTER)