public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105594] New: -Wuse-without-only issued for any submodule
@ 2022-05-13 16:00 everythingfunctional at protonmail dot com
2022-05-13 17:17 ` [Bug fortran/105594] " kargl at gcc dot gnu.org
2023-05-30 0:03 ` kargl at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: everythingfunctional at protonmail dot com @ 2022-05-13 16:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105594
Bug ID: 105594
Summary: -Wuse-without-only issued for any submodule
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: everythingfunctional at protonmail dot com
Target Milestone: ---
The -Wuse-without-only option issues a warning when compiling any submodule.
This is incorrect as a submodule statement is not a use statement, and cannot
contain an only qualifier.
For example the source code
module foo_m
interface
module subroutine foo
end subroutine
end interface
end module
submodule (foo_m) foo_s
contains
module procedure foo
end procedure
end submodule
when compiled like
$ gfortran -c -Wuse-without-only foo_m.f90
foo_m.f90:8:17:
8 | submodule (foo_m) foo_s
| 1
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105594] -Wuse-without-only issued for any submodule
2022-05-13 16:00 [Bug fortran/105594] New: -Wuse-without-only issued for any submodule everythingfunctional at protonmail dot com
@ 2022-05-13 17:17 ` kargl at gcc dot gnu.org
2023-05-30 0:03 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-05-13 17:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105594
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-05-13
CC| |kargl at gcc dot gnu.org
Priority|P3 |P4
--- Comment #1 from kargl at gcc dot gnu.org ---
This patch suppresses the warning and allows the code to compile.
diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 85aa153bd77..98c056ac7e5 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -7261,7 +7261,7 @@ gfc_use_module (gfc_use_list *module)
only_flag = module->only_flag;
current_intmod = INTMOD_NONE;
- if (!only_flag)
+ if (!only_flag && gfc_state_stack->state != COMP_SUBMODULE)
gfc_warning_now (OPT_Wuse_without_only,
"USE statement at %C has no ONLY qualifier");
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105594] -Wuse-without-only issued for any submodule
2022-05-13 16:00 [Bug fortran/105594] New: -Wuse-without-only issued for any submodule everythingfunctional at protonmail dot com
2022-05-13 17:17 ` [Bug fortran/105594] " kargl at gcc dot gnu.org
@ 2023-05-30 0:03 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-30 0:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105594
--- Comment #2 from kargl at gcc dot gnu.org ---
Created attachment 55194
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55194&action=edit
patch that fixes bug
Patch from comment #1 still fixes this bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-30 0:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 16:00 [Bug fortran/105594] New: -Wuse-without-only issued for any submodule everythingfunctional at protonmail dot com
2022-05-13 17:17 ` [Bug fortran/105594] " kargl at gcc dot gnu.org
2023-05-30 0:03 ` 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).