public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115653] New: USE without ONLY warning when compiling submodules
@ 2024-06-25 20:48 gmt3141 at gmail dot com
  2024-06-25 20:58 ` [Bug fortran/115653] " kargls at comcast dot net
  0 siblings, 1 reply; 2+ messages in thread
From: gmt3141 at gmail dot com @ 2024-06-25 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115653
           Summary: USE without ONLY warning when compiling submodules
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gmt3141 at gmail dot com
  Target Milestone: ---

When I compile a submodule with `-Wuse-without-only` option, a false positive
warning about USE without ONLY will be shown:

$ gfortran -Wuse-without-only greeting.f90
greeting.f90:13:19:

   13 | submodule (greet_m) greet_implementation_sm
      |                   1
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! greeting.f90
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

module greet_m

  implicit none

  interface
     module subroutine hello (name)
       character (len=*), intent (in), optional :: name
     end subroutine hello
  end interface

end module greet_m

submodule (greet_m) greet_implementation_sm

contains

  module subroutine hello (name)
    character (len=*), intent (in), optional :: name

    if (present (name)) then
       print '("Hello ", a, "!")', name
    else
       print '("Hello World!")'
    end if
  end subroutine hello

end submodule greet_implementation_sm

program greeting

  use greet_m, only: hello

  implicit none

  call hello
  call hello ('John')

end program greeting

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

end of thread, other threads:[~2024-06-25 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 20:48 [Bug fortran/115653] New: USE without ONLY warning when compiling submodules gmt3141 at gmail dot com
2024-06-25 20:58 ` [Bug fortran/115653] " kargls at comcast dot net

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).