Hi Thomas,

I am not so convinced that "plain english" messages are the way to go,
even if they appear better readable at first sight, if conciseness is
lost.  The main reason is that there three variants of the messages,
depending on context.  One of them refers to expecting either a
bounds-specification-list or a bounds-remapping-list.

Do you prefer sth. like

"All lower bounds and all or none of the upper bounds must be specified"

or

"Either all or none of the upper bounds must be specified at (1)"

(which we currently print in another context where it is wrong),

while other compilers print:

E.g. Crayftn:

  p(1 ,2:3) => t
    ^            
ftn-1768 crayftn: ERROR SUB, File = ptr-remap.f90, Line = 3, Column = 5 
  Invalid bounds-spec-list or bounds-remapping-list for this pointer assignment.

E.g. Intel:

ptr-remap.f90(3): error #8524: The syntax of this data pointer assignment is 
incorrect: either 'bound spec' or 'bound remapping' is expected in this 
context.   [1]
  p(1 ,2:3) => t
----^

Pointer remapping belongs IMHO to the 'more advanced' features and requires
some technical insight to get it right, which is why I think the related
error messages should be more technical and concise.

I'll think for another day or two.

Thanks,
Harald

> Gesendet: Dienstag, 12. März 2019 um 23:19 Uhr
> Von: "Thomas Koenig" <tkoe...@netcologne.de>
> An: "Harald Anlauf" <anl...@gmx.de>, "Dominique d'Humières" 
> <domi...@lps.ens.fr>
> Cc: gfortran <fort...@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
> Betreff: Re: [PR fortran/60091, patch] - Misleading error messages in rank-2 
> pointer assignment to rank-1 target
>
> Hi Harald,
> 
> > how about the attached version?  It is quite verbose and produces
> > messages like
> > 
> > Error: Expected list of 'lower-bound-expr:' or list of
> > 'lower-bound-expr:upper-bound-expr' at (1)
> 
> I think this way of specifying error messages
> 
> +#define BOUNDS_SPEC_LIST "list of %<lower-bound-expr:upper-bound-expr%>"
> 
> ...
> 
> +               gfc_error ("Rank remapping requires a "
> +                          BOUNDS_SPEC_LIST " at %L",
>                            &lvalue->where);
> 
> will cause trouble in translation of the error messages.
> 
> Could you maybe use something like
> 
> +               gfc_error ("Rank remapping requires "
> +                          lower and upper bounds at %L",
>                            &lvalue->where);
> 
> and possibly, instead of
> 
> -                   gfc_error ("Either all or none of the upper bounds"
> -                              " must be specified at %L", &lvalue->where);
> +                   gfc_error ("Rank remapping requires a "
> +                              BOUNDS_SPEC_LIST " at %L",
> +                              &lvalue->where);
>                     return false;
> 
> use
> 
> " Rank remapping requires that all lower and upper bounds be specified"
> 
> ?
> 
> (And I am fairly certain that my versions are not the best possible
> ones...)
> 
> So, either something like what you propsed (but without the #defines)
> or something like what I wrote above would be OK.
> 
> Regards
> 
>       Thomas
>

Reply via email to