public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109512] New: accepts implicit dummy procedure even with "implicit none (external)"
@ 2023-04-14 13:03 sebastien at debian dot org
  2023-04-14 16:16 ` [Bug fortran/109512] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sebastien at debian dot org @ 2023-04-14 13:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109512

            Bug ID: 109512
           Summary: accepts implicit dummy procedure even with "implicit
                    none (external)"
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebastien at debian dot org
  Target Milestone: ---

gfortran compiles the following source without error:

subroutine foo(bar)
  implicit none (external)
  call bar(1)
end subroutine foo

However my understanding is that it should reject it, because "bar" is an
implicit dummy procedure, which is forbidden by "implicit none (external)".

Note that this is not the same issue as Bug 100972, which was not about dummy
procedures.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/109512] accepts implicit dummy procedure even with "implicit none (external)"
  2023-04-14 13:03 [Bug fortran/109512] New: accepts implicit dummy procedure even with "implicit none (external)" sebastien at debian dot org
@ 2023-04-14 16:16 ` kargl at gcc dot gnu.org
  2023-05-28  3:48 ` kargl at gcc dot gnu.org
  2023-05-28  4:15 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-04-14 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109512

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2023-04-14

--- Comment #1 from kargl at gcc dot gnu.org ---
Confirmed.

8.7 IMPLICIT statement
...
An IMPLICIT NONE statement can indicate ..., or that external and
dummy procedures need to be explicitly given the EXTERNAL attribute.

'bar' is clearly a dummy procedure, so 'externa bar' is required.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/109512] accepts implicit dummy procedure even with "implicit none (external)"
  2023-04-14 13:03 [Bug fortran/109512] New: accepts implicit dummy procedure even with "implicit none (external)" sebastien at debian dot org
  2023-04-14 16:16 ` [Bug fortran/109512] " kargl at gcc dot gnu.org
@ 2023-05-28  3:48 ` kargl at gcc dot gnu.org
  2023-05-28  4:15 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-28  3:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109512

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/109512] accepts implicit dummy procedure even with "implicit none (external)"
  2023-04-14 13:03 [Bug fortran/109512] New: accepts implicit dummy procedure even with "implicit none (external)" sebastien at debian dot org
  2023-04-14 16:16 ` [Bug fortran/109512] " kargl at gcc dot gnu.org
  2023-05-28  3:48 ` kargl at gcc dot gnu.org
@ 2023-05-28  4:15 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-28  4:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109512

--- Comment #2 from kargl at gcc dot gnu.org ---
This patch catches the need for an external attribute.

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 6e42397c2ea..1e19712b413 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -3818,6 +3818,16 @@ resolve_call (gfc_code *c)
   /* Resume assumed_size checking.  */
   need_full_assumed_size--;

+  /* If 'implicit none (external)' and the symbol is a dummy argument,
+     check for an 'external' attribute.  */
+  if (csym->ns->has_implicit_none_export
+      && csym->attr.external == 0 && csym->attr.dummy == 1)
+    {
+      gfc_error ("Dummy procedure %qs at %C requires an EXTERNAL attribute",
+                csym->name);
+      return false;
+    }
+
   /* If external, check for usage.  */
   if (csym && is_external_proc (csym))
     resolve_global_procedure (csym, &c->loc, 1);

A dejagnu-ified testcase.

! { dg-do compile }
subroutine foo(bar)
  implicit none (external)
  call bar(1)        ! { dg-error "requires an EXTERNAL attribute" }
end subroutine foo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-28  4:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 13:03 [Bug fortran/109512] New: accepts implicit dummy procedure even with "implicit none (external)" sebastien at debian dot org
2023-04-14 16:16 ` [Bug fortran/109512] " kargl at gcc dot gnu.org
2023-05-28  3:48 ` kargl at gcc dot gnu.org
2023-05-28  4:15 ` kargl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).