This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/54195] [4.8 Regression][OOP] IMPORT fails with GENERIC TBP: "is already present in the interface"


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54195

--- Comment #4 from janus at gcc dot gnu.org 2012-08-07 20:23:26 UTC ---
My first attempt to fix it would be something like this:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 190186)
+++ gcc/fortran/resolve.c       (working copy)
@@ -11448,7 +11448,7 @@

       /* Add target to non-typebound operator list.  */
       if (!target->specific->deferred && !derived->attr.use_assoc
-         && p->access != ACCESS_PRIVATE)
+         && !derived->attr.imported && p->access != ACCESS_PRIVATE)
        {
          gfc_interface *head, *intr;
          if (gfc_check_new_interface (derived->ns->op[op], target_proc,

This indeed makes the error in comment #0 go away, and does not seem to
introduce any regressions in the typebound_* test cases.

However: Witout the patch, the code guarded by the IF statement above is called
twice (which leads to the error). But with the patch, it is not called at all
any more (while it should be called once!). So the patch can not be fully
correct.

What I do not understand is: The symbol 'foo' exists in the module namespace,
as well as in the namespace of 'bar'. But in both it has the 'imported'
attribute, which sounds wrong to me (or at least contra-intuitive).


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