[Bug fortran/49638] [OOP] length parameter is ignored when overriding type bound character functions with constant length.
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 4 11:15:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49638
--- Comment #12 from Mikael Morin <mikael at gcc dot gnu.org> 2011-08-04 11:14:36 UTC ---
If we are willing to do some simple expression comparisons, here is what I
think should be supported (most common cases):
- constants: this is the minimum
- variables/dummies: for the case len=n
- sub-components: for the case len=derived%char_length_comp
- function calls: for the case len=len(some_char)
- arithmetic operators: for the case len=n+1
So, only missing in your preliminary patch are sub-components and function.
(In reply to comment #9)
> > I don't know however how you will have two corresponding dummy
> > arguments (from different procedures) compare equal.
>
> Well, the patch in comment #7 handles this by just comparing the names of the
> arguments (which have to be the same in overridden procedures, so I this this
> will be enough):
>
> + case EXPR_VARIABLE:
> + if (strcmp (e1->symtree->n.sym->name, e1->symtree->n.sym->name) != 0)
> + return FAILURE;
>
Ah, yes.
>
> gfc_dep_compare_expr relies on a function called 'gfc_are_identical_variables'.
> This really checks for equal symbols, which is too strict for our case here (so
> we may add an extra argument to loosen this restriction?).
Yes, makes sense. Then you have components and functions almost for free.
More information about the Gcc-bugs
mailing list