public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104630] New: module subroutine not accessible from submodule
@ 2022-02-22 5:46 neil.n.carlson at gmail dot com
2022-05-24 19:37 ` [Bug fortran/104630] " kargl at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: neil.n.carlson at gmail dot com @ 2022-02-22 5:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104630
Bug ID: 104630
Summary: module subroutine not accessible from submodule
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: neil.n.carlson at gmail dot com
Target Milestone: ---
Consider this minimal example.
File module.f90:
module modA
private
type, public :: typeA
contains
procedure :: foo
end type
interface
module subroutine foo(this)
class(typeA) :: this
end subroutine
end interface
contains
subroutine bar(this)
type(typeA) :: this
end subroutine
end module
File submodule.f90:
submodule(modA) foo_impl
contains
module subroutine foo(this)
class(typeA) :: this
call bar(this) ! a module subroutine in the host module
end subroutine
end submodule
File main.f90:
use modA
end
The implementation of subroutine foo in the submodule should have
access to subroutine bar defined in its host module but it apparently
does not judging from the link error:
$ gfortran module.f90 submodule.f90 main.f90
/usr/bin/ld: /tmp/ccEycu6t.o: in function `__moda_MOD_foo':
gfortran-20220221-submodule.f90:(.text+0x17): undefined reference to
`__moda_MOD_bar'
collect2: error: ld returned 1 exit status
If the 3 program units are combined into a single file, that will
compile and link without error.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/104630] module subroutine not accessible from submodule
2022-02-22 5:46 [Bug fortran/104630] New: module subroutine not accessible from submodule neil.n.carlson at gmail dot com
@ 2022-05-24 19:37 ` kargl at gcc dot gnu.org
2022-11-16 23:48 ` jwmwalrus at gmail dot com
2023-06-30 13:58 ` daryl.00179 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-05-24 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104630
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Neil Carlson from comment #0)
> Consider this minimal example.
>
> File module.f90:
> module modA
> private
I suspect you already found the work around.
Remove the private attribute.
> type, public :: typeA
> contains
> procedure :: foo
> end type
> interface
> module subroutine foo(this)
> class(typeA) :: this
> end subroutine
> end interface
> contains
> subroutine bar(this)
> type(typeA) :: this
> end subroutine
> end module
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/104630] module subroutine not accessible from submodule
2022-02-22 5:46 [Bug fortran/104630] New: module subroutine not accessible from submodule neil.n.carlson at gmail dot com
2022-05-24 19:37 ` [Bug fortran/104630] " kargl at gcc dot gnu.org
@ 2022-11-16 23:48 ` jwmwalrus at gmail dot com
2023-06-30 13:58 ` daryl.00179 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: jwmwalrus at gmail dot com @ 2022-11-16 23:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104630
--- Comment #2 from John <jwmwalrus at gmail dot com> ---
This issue is still in v12.2.0.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/104630] module subroutine not accessible from submodule
2022-02-22 5:46 [Bug fortran/104630] New: module subroutine not accessible from submodule neil.n.carlson at gmail dot com
2022-05-24 19:37 ` [Bug fortran/104630] " kargl at gcc dot gnu.org
2022-11-16 23:48 ` jwmwalrus at gmail dot com
@ 2023-06-30 13:58 ` daryl.00179 at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: daryl.00179 at gmail dot com @ 2023-06-30 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104630
Pablo <daryl.00179 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daryl.00179 at gmail dot com
--- Comment #3 from Pablo <daryl.00179 at gmail dot com> ---
This issue is still present in v13.1.0. And it has also been reported in bug
#88632.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-30 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 5:46 [Bug fortran/104630] New: module subroutine not accessible from submodule neil.n.carlson at gmail dot com
2022-05-24 19:37 ` [Bug fortran/104630] " kargl at gcc dot gnu.org
2022-11-16 23:48 ` jwmwalrus at gmail dot com
2023-06-30 13:58 ` daryl.00179 at gmail dot com
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).