[Bug fortran/92533] [F2018] Permit module names in access-stmt (public::/private::)

2019-11-25 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92533

--- Comment #5 from Tobias Burnus  ---
(In reply to Tobias Burnus from comment #4)
> Probably somewhere in module.c's gfc_use_module.

That's actually to early. gfc_use_module is run after all use statements have
been processed while the public/private statement comes much later.
Additionally for (cf. comment 1)
  use B
  use C
the information that a symbol has been loaded from B and/or C is lost – only
the true module ("A") remains. But we need to know later on that the symbol has
been loaded via B *and* C such that with "private :: B; public :: C" the
symbols are properly marked as public.
Hence, some tracking of the use-associated symbols until either resolving them
or until writing them to the .mod is needed – some kind of (symbol,
list-of-modules) container or (module, list-of-symbols)

[Bug fortran/92533] [F2018] Permit module names in access-stmt (public::/private::)

2019-11-25 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92533

--- Comment #4 from Tobias Burnus  ---
Created attachment 47354
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47354=edit
Parsing-only patch – TODO: resolve PUBLIC/PRIVATE + handle example of comment 1

First patch. Need to resolve use-associated symbols such that the example of
comment 1 passes. – Probably somewhere in module.c's gfc_use_module.

[Bug fortran/92533] [F2018] Permit module names in access-stmt (public::/private::)

2019-11-15 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92533

--- Comment #3 from Tobias Burnus  ---
NOTE:
  use, public :: C
is not (yet) permitted, but might well be added in the future. See
https://github.com/j3-fortran/fortran_proposals/issues/88 and
https://mailman.j3-fortran.org/pipermail/j3/2019-November/thread.html#11753
Note the example 'use, public :: A; use, private :: A' by Bob, which can be
resolved via the quoted text previous comment of this PR.

[Bug fortran/92533] [F2018] Permit module names in access-stmt (public::/private::)

2019-11-15 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92533

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> Note that one needs to handle:
> 
> module A; integer, parameter :: A1 = 1, A2 = 2; end module A
> module B; use A; end module B
> module C; use A; end module B

This code cannot possibly be correct.  Perhaps, not using
the semicolon when writing test code would be a good idea.

[Bug fortran/92533] [F2018] Permit module names in access-stmt (public::/private::)

2019-11-15 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92533

--- Comment #1 from Tobias Burnus  ---
Note that one needs to handle:

module A; integer, parameter :: A1 = 1, A2 = 2; end module A
module B; use A; end module B
module C; use A; end module B
module D
  use B
  use C
  private
  private B
  public C
 ! private :: A1

That's resolved by:

"If an identifier is accessed by use association and not declared in the
module, and the name of every module from which it is accessed appears in an
access-stmt in the scoping unit, its default accessibility is PRIVATE if the
access-spec in every such access-stmt is PRIVATE, or PUBLIC if the access-spec
in any such access-stmt is PUBLIC."