[PR fortran/60091, patch] - Misleading error messages in rank-2 pointer assignment to rank-1 target
Dominique d'Humières
dominiq@lps.ens.fr
Thu Mar 14 11:14:00 GMT 2019
> Le 13 mars 2019 à 13:39, Harald Anlauf <anlauf@gmx.de> a écrit :
>
> 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.
Well, "Syntax error" is concise, but not really helpful!
> 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"
This is what I expect for p(:,:)=>a and I won’t complain if "use the later for bound remapping" is added
when the target is a rank 1 array.
For mat(2, 6) => arr I would prefer the above error rather than "Expected bounds specification ».
For p(1:,1:)=>a where a is a rank 1 target, I’ll go with
"all the upper bounds must be specified for bound remapping"
> or
>
> "Either all or none of the upper bounds must be specified at (1)"
This is what I expect for p(1:3,1:)=>a with the same remark as above about bound remapping.
> (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
Agreed
> and requires
> some technical insight to get it right, which is why I think the related
> error messages should be more technical and concise.
Here I disagree, the error message should try to tell the user what is wrong
without requiring any access to the standard.
>
> I'll think for another day or two.
>
> Thanks,
> Harald
These defines should probably be swapped
+#define BOUNDS_SPEC_LIST "list of %<lower-bound-expr:upper-bound-expr%>"
+#define BOUNDS_REMAPPING_LIST "list of %<lower-bound-expr:%>"
to match
> R1035 bounds-spec is lower-bound-expr :
> R1036 bounds-remapping is lower-bound-expr : upper-bound-exp
Dominique
More information about the Gcc-patches
mailing list