]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/23663 (rejects entry point as a value)
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Sep 2005 14:37:44 +0000 (16:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Sep 2005 14:37:44 +0000 (16:37 +0200)
PR fortran/23663
* primary.c (match_actual_arg): Handle ENTRY the same way
as FUNCTION.

* gfortran.fortran-torture/execute/entry_11.f90: New test.

From-SVN: r104453

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/entry_11.f90 [new file with mode: 0644]

index 9dd49c4fbbd3a9f57cfc946a4aaec35e0ee5e2e3..4b8183cdab928f33c9ff1420aa3c5c40be6bc805 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/23663
+       * primary.c (match_actual_arg): Handle ENTRY the same way
+       as FUNCTION.
+
 2005-09-18  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        * Make-lang.in: Make check-fortran alias for check-gfortran.
index 3ef8d4e376b8983fa6cc29a047b807ee92354f56..76eed6b623a067439cff2baad352acada3276882 100644 (file)
@@ -1324,11 +1324,27 @@ match_actual_arg (gfc_expr ** result)
 
          /* If the symbol is a function with itself as the result and
             is being defined, then we have a variable.  */
-         if (sym->result == sym
-             && (gfc_current_ns->proc_name == sym
+         if (sym->attr.function && sym->result == sym)
+           {
+             if (gfc_current_ns->proc_name == sym
                  || (gfc_current_ns->parent != NULL
-                     && gfc_current_ns->parent->proc_name == sym)))
-           break;
+                     && gfc_current_ns->parent->proc_name == sym))
+               break;
+
+             if (sym->attr.entry
+                 && (sym->ns == gfc_current_ns
+                     || sym->ns == gfc_current_ns->parent))
+               {
+                 gfc_entry_list *el = NULL;
+
+                 for (el = sym->ns->entries; el; el = el->next)
+                   if (sym == el->sym)
+                     break;
+
+                 if (el)
+                   break;
+               }
+           }
        }
 
       e = gfc_get_expr ();     /* Leave it unknown for now */
index 64f08bd59283340e38eaba1a6ee3997bf10502f8..eddca508c69aeeca100cc92466bf625676b53843 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/23663
+       * gfortran.fortran-torture/execute/entry_11.f90: New test.
+
 2005-09-20  Dorit Nuzman  <dorit@il.ibm.com>
 
        * gcc.dg/vect/vect-40.c: Remove pointers to "aligned types".
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/entry_11.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/entry_11.f90
new file mode 100644 (file)
index 0000000..916891f
--- /dev/null
@@ -0,0 +1,16 @@
+! PR fortran/23663
+      function i (n)
+      i = n
+      i = max (i, 6)
+      return
+      entry j (n)
+      j = n
+      j = max (j, 3)
+      end
+
+      program entrytest
+      if (i (8).ne.8) call abort
+      if (i (4).ne.6) call abort
+      if (j (0).ne.3) call abort
+      if (j (7).ne.7) call abort
+      end