[Bug fortran/33499] Rejects valid module with a contained function with an ENTRY

pault at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 23 14:14:00 GMT 2007



------- Comment #8 from pault at gcc dot gnu dot org  2007-11-23 14:13 -------
This is not regtested yet but seems to be OK:

Index: gcc/fortran/decl.c
===================================================================
*** gcc/fortran/decl.c  (révision 130286)
--- gcc/fortran/decl.c  (copie de travail)
*************** get_proc_name (const char *name, gfc_sym
*** 715,723 ****

        if (*result == NULL)
        rc = gfc_get_symbol (name, NULL, result);
!       else if (gfc_get_symbol (name, NULL, &sym) == 0
!                && sym
!                && sym->ts.type != BT_UNKNOWN
                 && (*result)->ts.type == BT_UNKNOWN
                 && sym->attr.flavor == FL_UNKNOWN)
        /* Pick up the typespec for the entry, if declared in the function
--- 715,721 ----

        if (*result == NULL)
        rc = gfc_get_symbol (name, NULL, result);
!       else if (!gfc_get_symbol (name, NULL, &sym) && sym
                 && (*result)->ts.type == BT_UNKNOWN
                 && sym->attr.flavor == FL_UNKNOWN)
        /* Pick up the typespec for the entry, if declared in the function
*************** get_proc_name (const char *name, gfc_sym
*** 727,733 ****
--- 725,742 ----
           to the local version.  This latter ensures a correct clearing
           of the symbols.  */
          {
+           /* If the ENTRY proceeds its specification, we need to ensure
+              that this does not raise a "has no IMPLICIT type" error.  */
+           if (sym->ts.type == BT_UNKNOWN)
+             sym->attr.untyped = 1;
+
            (*result)->ts = sym->ts;
+
+           /* Put the symbol in the procedure namespace so that, should
+              the ENTRY preceed its specification, the specification
+              can be applied.  */
+           (*result)->ns = gfc_current_ns;
+
            gfc_find_sym_tree (name, gfc_current_ns, 0, &st);
            st->n.sym = *result;
            st = gfc_get_unique_symtree (gfc_current_ns);

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-10-05 13:05:03         |2007-11-23 14:13:57
               date|                            |


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



More information about the Gcc-bugs mailing list