public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine
@ 2020-09-08 19:22 foreese at gcc dot gnu.org
  2020-09-09  6:44 ` [Bug fortran/96986] [8/9/10/11 " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: foreese at gcc dot gnu.org @ 2020-09-08 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96986
           Summary: [8 Regression] Explicit interface required: volatile
                    argument for ENTRY subroutine
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foreese at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49200
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49200&action=edit
Testcase which exhibits the regression

GCC 8.3.1 does not accept the following program, but all versions 4.x through
7.x and <= 8.3.0 do:

$ cat volatile.for
      subroutine volatile_test ()
        implicit none
        integer(4), volatile :: va

        entry fun_a()
        return

        entry fun_b(va)
          call fun_c()
        return
      end

      subroutine fun_c ()
        implicit none
        call fun_a()
        return
      end
$ gfortran -std=legacy -c volatile.for
volatile.for:15:18:

         call fun_a()
                  1
Error: Explicit interface required for ‘fun_a’ at (1): volatile argument


It seems that because fun_b() has a volatile argument, the subroutine
volatile_test() is marked as such. Subsequently the call to fun_a() from
fun_c() within the same procedure trips the error.

The regression appears to have been introduced in r269895 on gcc-9 which fixed
PR 78865. The fix was backported to gcc-8 by r270032 and released as part of
8.3.1.

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
@ 2020-09-09  6:44 ` rguenth at gcc dot gnu.org
  2020-12-14 12:49 ` dominiq at lps dot ens.fr
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-09  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
            Summary|[8 Regression] Explicit     |[8/9/10/11 Regression]
                   |interface required:         |Explicit interface
                   |volatile argument for ENTRY |required: volatile argument
                   |subroutine                  |for ENTRY subroutine
   Target Milestone|---                         |8.5

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
  2020-09-09  6:44 ` [Bug fortran/96986] [8/9/10/11 " rguenth at gcc dot gnu.org
@ 2020-12-14 12:49 ` dominiq at lps dot ens.fr
  2021-01-01 20:04 ` anlauf at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-12-14 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-12-14
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed, but is the error message an error?

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
  2020-09-09  6:44 ` [Bug fortran/96986] [8/9/10/11 " rguenth at gcc dot gnu.org
  2020-12-14 12:49 ` dominiq at lps dot ens.fr
@ 2021-01-01 20:04 ` anlauf at gcc dot gnu.org
  2021-01-01 21:46 ` foreese at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-01 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
F2018 has:

! 15.4.2.2 Explicit interface

! Within the scope of a procedure identifier, the procedure shall have an
! explicit interface if it is not a statement function and

! (3) the procedure has a dummy argument that
!     (a) has the ALLOCATABLE, ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE,
!         or VOLATILE attribute,

So I'd say the code in comment#0 is invalid, although the compiler is not
required to diagnose this.

If you agree, we will close the issue as INVALID.

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-01 20:04 ` anlauf at gcc dot gnu.org
@ 2021-01-01 21:46 ` foreese at gcc dot gnu.org
  2021-01-01 23:15 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: foreese at gcc dot gnu.org @ 2021-01-01 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Fritz Reese <foreese at gcc dot gnu.org> ---
(In reply to anlauf from comment #2)
...
> So I'd say the code in comment#0 is invalid, although the compiler is not
> required to diagnose this.
> 
> If you agree, we will close the issue as INVALID.

The error message blames fun_a() while neither fun_a() nor its containing
subroutine volatile_test() have a VOLATILE dummy argument. Do you think
15.4.2.2 still applies?

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-01-01 21:46 ` foreese at gcc dot gnu.org
@ 2021-01-01 23:15 ` anlauf at gcc dot gnu.org
  2021-01-02  1:32 ` kargl at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-01 23:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Priority|P4                          |P5

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to Fritz Reese from comment #3)
> The error message blames fun_a() while neither fun_a() nor its containing
> subroutine volatile_test() have a VOLATILE dummy argument. Do you think
> 15.4.2.2 still applies?

The standard has:

! 15.6.2.1  General

! A procedure is defined by the initial SUBROUTINE or FUNCTION statement of a
! subprogram, and each ENTRY statement defines an additional procedure
(15.6.2.6).

! 15.6.2.6  ENTRY statement

! An ENTRY statement permits a procedure reference to begin with a particular
! executable statement within the function or subroutine subprogram in which
! the ENTRY statement appears.

!...

! If the ENTRY statement is in a subroutine subprogram, an additional
subroutine
! is defined by that subprogram. ...

So basically I think the error is correct.  Nevertheless the error message is
probably sub-optimal.  Would you prefer it to refer to "volatile_test"?

I personally do not use ENTRY in my own code, and I don't know how to properly
write an explicit interface for a similar subroutine including its entries.

The best solution would be the use of modules, which is what I do.

Downgrading to P5 / diagnostic.

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-01-01 23:15 ` anlauf at gcc dot gnu.org
@ 2021-01-02  1:32 ` kargl at gcc dot gnu.org
  2021-01-02 19:53 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-01-02  1:32 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Priority|P5                          |P4
             Status|WAITING                     |NEW

--- Comment #5 from kargl at gcc dot gnu.org ---
The code is valid.  Gfortran error message is bogus.  The pertinent
part of the Fortran standard is the last sentence here:

   If the ENTRY statement is in a subroutine subprogram, an additional
   subroutine is defined by that subprogram.  The name of the subroutine
   is entry-name. The dummy arguments of the subroutine are those
   specified in the ENTRY statement

The entry statement 'entry func_a()' in question has no dummy arguments.

The portion of the Fortran standard quoted in comment #2 clearly
does not apply.

Also note that the requirement of an explicit interface comes if a
programmer wants to call 'entry func_b(va)'.   Thus, the following
code is also conforming.

subroutine bar(va)
   integer, volatile :: va
   va = 42
end subroutine bar

program foo
   integer n
   interface
      subroutine bar(va)
         integer, volatile :: va
      end subroutine bar
   end interface
   call bar(n)
   print *, n
end program foo

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-01-02  1:32 ` kargl at gcc dot gnu.org
@ 2021-01-02 19:53 ` anlauf at gcc dot gnu.org
  2021-01-02 20:50 ` sgk at troutmask dot apl.washington.edu
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-02 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #5)
>    If the ENTRY statement is in a subroutine subprogram, an additional
>    subroutine is defined by that subprogram.  The name of the subroutine
>    is entry-name. The dummy arguments of the subroutine are those
>    specified in the ENTRY statement

Well, I stumbled over the "additional subroutine".

I assume that the "additional subroutine" wouldn't exist without the containing
subprogram in the first place.  Maybe a consultation of c.l.f. could help.

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

* [Bug fortran/96986] [8/9/10/11 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-01-02 19:53 ` anlauf at gcc dot gnu.org
@ 2021-01-02 20:50 ` sgk at troutmask dot apl.washington.edu
  2021-05-14  9:53 ` [Bug fortran/96986] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-01-02 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jan 02, 2021 at 07:53:17PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96986
> 
> --- Comment #6 from anlauf at gcc dot gnu.org ---
> (In reply to kargl from comment #5)
> >    If the ENTRY statement is in a subroutine subprogram, an additional
> >    subroutine is defined by that subprogram.  The name of the subroutine
> >    is entry-name. The dummy arguments of the subroutine are those
> >    specified in the ENTRY statement
> 
> Well, I stumbled over the "additional subroutine".
> 
> I assume that the "additional subroutine" wouldn't exist without the containing
> subprogram in the first place.  Maybe a consultation of c.l.f. could help.
> 

Not sure what you think clf will provide.  Seems clear to me that

subroutine volatile_test()
   integer, volatile :: va
   entry fun_a()
   return
   entry fun_b(va)
      call fun_c()
   return
end subroutine volatile_test

is equivalent

subroutine volatile_test()
   integer, volatile :: va
   return
      call fun_c()
   return
end subroutine volatile_test

subroutine fun_a()
   integer, volatile :: va
   return
      call fun_c()
   return
end subroutine fun_a()

subroutine fun_b(va)
   integer, volatile :: va
   call fun_c()
   return
end subroutine fun_b 

Here, only fun_b() requires an explicit interface if it is
used in another scoping unit.  AFAICT, a programmer is  
required to add 

interface
   subroutine fun_b(va)
      integer, volatile :: va
   end subroutine fun_b
end interface

to that scoping unit.

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

* [Bug fortran/96986] [9/10/11/12 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-01-02 20:50 ` sgk at troutmask dot apl.washington.edu
@ 2021-05-14  9:53 ` jakub at gcc dot gnu.org
  2021-06-01  8:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug fortran/96986] [9/10/11/12 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-05-14  9:53 ` [Bug fortran/96986] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-06-01  8:18 ` rguenth at gcc dot gnu.org
  2022-05-27  9:43 ` [Bug fortran/96986] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug fortran/96986] [10/11/12/13 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-06-01  8:18 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:43 ` rguenth at gcc dot gnu.org
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07 10:38 ` [Bug fortran/96986] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug fortran/96986] [10/11/12/13 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2022-05-27  9:43 ` [Bug fortran/96986] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07 10:38 ` [Bug fortran/96986] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug fortran/96986] [11/12/13/14 Regression] Explicit interface required: volatile argument for ENTRY subroutine
  2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:38 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 19:22 [Bug fortran/96986] New: [8 Regression] Explicit interface required: volatile argument for ENTRY subroutine foreese at gcc dot gnu.org
2020-09-09  6:44 ` [Bug fortran/96986] [8/9/10/11 " rguenth at gcc dot gnu.org
2020-12-14 12:49 ` dominiq at lps dot ens.fr
2021-01-01 20:04 ` anlauf at gcc dot gnu.org
2021-01-01 21:46 ` foreese at gcc dot gnu.org
2021-01-01 23:15 ` anlauf at gcc dot gnu.org
2021-01-02  1:32 ` kargl at gcc dot gnu.org
2021-01-02 19:53 ` anlauf at gcc dot gnu.org
2021-01-02 20:50 ` sgk at troutmask dot apl.washington.edu
2021-05-14  9:53 ` [Bug fortran/96986] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2022-05-27  9:43 ` [Bug fortran/96986] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug fortran/96986] [11/12/13/14 " rguenth 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).