This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, OOP] PR 49638: [OOP] length parameter is ignored when overriding type bound character functions with constant length.


Hi Thomas,

>> + ? ? ?/* Check string length. ?*/
>> + ? ? ?if (proc_target->result->ts.type == BT_CHARACTER
>> + ? ? ? && ?proc_target->result->ts.u.cl&& ?old_target->result->ts.u.cl
>> + ? ? ? && ?gfc_dep_compare_expr (proc_target->result->ts.u.cl->length,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?old_target->result->ts.u.cl->length) !=
>> 0)
>
> This remains incorrect.

well, I'm not so sure. If we assume a 'strict' interpretation of
Mikael's standard quotes, then it would be ok.


> Please change that to a warning (at least) if gfc_dep_compare_expr returns
> -2.

I don't think this is a good idea: gfc_dep_compare_expr also tries to
determine whether one expr is larger or smaller than the other.
Therefore the return value "-2" can have two meanings:

1) We don't know if the expressions are equal.
2) We know that they are unequal, but we don't know which one is larger.

For the overriding check, we don't care about which expr is larger, we
want to know whether they are the same or not. So, in many cases we
will just get a warning, although we definitely know that the expr's
are different.

Example: Differing expr_type, e.g. one procedure has len=3, the other
has len=x. It's obvious they are different, but gfc_dep_compare_expr
will still return "-2" (because we can not tell which one is larger).

I would tend to leave the check like it is (i.e. rejecting everything
!=0), but if you insist, one could extend the output values of
gfc_dep_compare_expr, e.g. like this:
-3 = we know nothing (neither if they could be equal, nor which one is larger)
-2 = we know they are different, but not which one is larger

However, one may then have to modify the diagnostics on these return
values in quite a few places(?).

Note: The last version of my patch also regtests fine.

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]