https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83135
Bug ID: 83135 Summary: Routines in submodules treat protected variables from other modules as public Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: ying.zhu at doctorant dot ec-lyon.fr Target Milestone: --- Created attachment 42698 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42698&action=edit Code to illustrate the bug I define a variable xx in mod1 with protected attribute, then use mod1 in mod2. echo_xx is a submodule subroutine implemented in a submodule of mod2, then I find echo_xx can change the value of xx and gnu fortran allows this when compiling and running, protected attribute doesn't work at all. Meanwhile, the value of xx can not be changed in main program or other module subroutines not submodule subroutines. Thant means, this bug is only related to submodules.