Re: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-07-02 Thread Paul Richard Thomas
Dear All,

Committed as revision 225354.

Compared with the submitted version, I have added another test -
submodule_7.f90. This is a slightly tweaked version of the example in
the F2008 standard. In order to get it to compile, the error produced
by the main program's interface block was suppressed by excluding
module procedures from the error in interface.c. Otherwise, the
compiler complains that module procedures are not module procedures.

Thanks to Damian, Reinhold, Salvatore and FX for help, comments and advice.

I'll get on and sort out the business with private symbols now.

Cheers

Paul


On 30 June 2015 at 15:51, FX fxcoud...@gmail.com wrote:
 Hi Paul,

 I don’t feel confident enough in many parts of the code (including the module 
 part) to formally review it, but from what I’ve read it seemed rather logical 
 and well-commented. If it regtests fine, I think your plan (especially at the 
 current GCC stage) of committing this week is sound.

 One question I had is: does this change the .mod file format in any case? I 
 don’t think, cause you don’t seem to bump the version number, but have you 
 checked on specific cases (like, the mega cp2k example) that the patch indeed 
 does not change existing module files (the ones that do not use submodules)?

 Cheers, and thanks for this patch!

 FX




-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx


Re: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-30 Thread Paul Richard Thomas
Dear All,

Please find attached the latest version of the submodule patch. You
might note that the number of the patch has been incremented by two.
The intermediate version went to Reinhold Bader and co for testing.
The main improvements in this version are:
(i) As reported by Reinhold, the interface declaration of the function
result in the abbreviated form of module procedure was not being
correctly incorporated. The only reason why the previous version
worked at all was that I wasn't using implicit none... or, rather,  I
did not detect the error for that reason ***blush*** This has been
fixed in parse.c(get_modproc_result);
(ii) Repetition of the dummy or result declarations is now caught and
prevents a segfault as the parser state stack dies; and
(iii) Various new errors are tested in submodule_4.f90 and Reinhold's
test has been added as submodule_6.f90.

Please note that the issue with PRIVATE statements or attributes in
modules has not been corrected yet. I will correct this once the
attached has been committed. Private components are handled correctly,
however.

Bootstrapped and regtested on FC21/x86_64 - OK for trunk?

If the patch is not reviewed by Thursday evening (21:00 CET), I will
commit it anyway unless Reinhold or Salvatore come up with and
further, significant issues. The new elements in the patch are well
ring-fenced by new attributes or F2008 specific declarations and so I
do not believe that it will cause any regressions. Any minor issues
that come up can be dealt with later. I am anxious to get to work on
the PRIVATE issue and want to do so on the basis of this patch being
committed.

With best regards

Paul

2015-06-30  Paul Thomas  pa...@gcc.gnu.org

PR fortran/52846
* decl.c (get_proc_name): Make a partially populated interface
symbol to carry the characteristics of a module procedure and
its result.
(variable_decl): Declarations of dummies or results in the
abreviated form of module procedure is an error.
(gfc_match_import): IMPORT is not permitted in the interface
declaration of module procedures.
(match_attr_spec): Submodule variables have implicit save
attribute for F2008 onwards.
(gfc_match_prefix): Add 'module' as the a prefix and set the
module_procedure attribute.
(gfc_match_formal_arglist): For a module procedure keep the
interface formal_arglist from the interface, match new the
formal arguments and then compare the number and names of each.
(gfc_match_procedure): Add case COMP_SUBMODULE.
(gfc_match_function_decl, gfc_match_subroutine_decl): Set the
module_procedure attribute.
(gfc_match_entry, gfc_match_end):  Add case COMP_SUBMODULE. If
attr abr_modproc_decl is set, switch the message accordingly
for subroutines and functions.
(gfc_match_submod_proc): New function to match the abbreviated
style of submodule declaration.
* gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the
attribute bits 'used_in_submodule' and 'module_procedure'. Add
the bit field 'abr_modproc_decl' to gfc_symbol. Add prototypes
for 'gfc_copy_dummy_sym', 'gfc_check_dummy_characteristics' and
'gfc_check_result_characteristics'.
* interface.c : Add the prefix 'gfc_' to the names of functions
'check_dummy(result)_characteristics' and all their references.
* match.h : Add prototype for 'gfc_match_submod_proc' and
'gfc_match_submodule'.
* module.c (gfc_match_submodule): New function. Add handling
for the 'module_procedure' attribute bit.
* parse.c (decode_statement): Set attr has_'import_set' for
the interface declaration of module procedures. Handle a match
occurring in 'gfc_match_submod_proc' and a match for
'submodule'.
(gfc_enclosing_unit): Include the state COMP_SUBMODULE.
(gfc_ascii_statement): Add END SUBMODULE.
(accept_statement): Add ST_SUBMODULE.
(parse_spec): Disallow statement functions in a submodule
specification part.
(parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE
twice each.
(get_modproc_result): Copy the result symbol of the interface.
(parse_progunit): Call it.
(set_syms_host_assoc): Make symbols from the ancestor module
and submodules use associated, as required by the standard and
set all private components public. Module procedures 'external'
attribute bit is reset and the 'used_in_submodule' bit is set.
(parse_module): If this is a submodule, use the ancestor module
and submodules. Traverse the namespace, calling
'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE.
* parse.h : Add COMP_SUBMODULE.
* primary.c (match_variable): Add COMP_SUBMODULE.
* resolve.c (compare_fsyms): New function to compare the dummy
characteristics of a module procedure with its interface.
(resolve_fl_procedure): Compare the procedure, result and dummy
characteristics of a module_procedure with its interface, using
'compare_fsyms' for the 

Re: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-30 Thread FX
Hi Paul,

I don’t feel confident enough in many parts of the code (including the module 
part) to formally review it, but from what I’ve read it seemed rather logical 
and well-commented. If it regtests fine, I think your plan (especially at the 
current GCC stage) of committing this week is sound.

One question I had is: does this change the .mod file format in any case? I 
don’t think, cause you don’t seem to bump the version number, but have you 
checked on specific cases (like, the mega cp2k example) that the patch indeed 
does not change existing module files (the ones that do not use submodules)?

Cheers, and thanks for this patch!

FX



AW: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-25 Thread Bader, Reinhold
Looks much better.

Attached another test case that fails compilation. The function result as 
declared
in the module procedure interface is not propagated to the submodule that uses 
the
argument/resultless form in the implementation. 

Cheers
Reinhold

 -Ursprüngliche Nachricht-
 Von: Paul Richard Thomas [mailto:paul.richard.tho...@gmail.com]
 Gesendet: Donnerstag, 25. Juni 2015 17:16
 An: fort...@gcc.gnu.org; gcc-patches
 Cc: Damian Rouson; Tobias Burnus; salvatore.filipp...@uniroma2.it; Bader,
 Reinhold
 Betreff: Re: [Patch, fortran] PR52846 - [F2008] Support submodules
 
 Dear All,
 
 Please find attached an updated version of the submodule patch.
 Reinhold Bader uncovered a couple of bugs, which have now been fixed:
 (i) IMPORT is no longer permitted in module_procedure interface
 bodies, as required by F2008(C1210). Instead, import occurs
 automatically; and
 (ii) The end statement for the abreviated module procedure declaration
 was wrong; should have been END PROCEDURE. I started introducing
 COMP_MODPROC_FUNC/SUBR in the parser to fix this. However, many of the
 if statement became impossibly torturous considering that there was
 only one place where it matters. Therefore, I decided to add a bit
 field to gfc_symbol as the least invasive way of dealing with the
 problem.
 
 The testcases were modified accordingly.
 
 Bootstraps and regtests on FC21/x86_64 - OK for trunk?
 
 Thanks Reinhold!
 
 Paul
 
 2015-06-25  Paul Thomas  pa...@gcc.gnu.org
 
 PR fortran/52846
 * decl.c (get_proc_name): Make a partially populated interface
 symbol to carry the characteristics of a module procedure and
 its result.
 (gfc_match_import): IMPORT is not permitted in the interface
 declaration of module procedures.
 (match_attr_spec): Submodule variables have implicit save
 attribute for F2008 onwards.
 (gfc_match_prefix): Add 'module' as the a prefix and set the
 module_procedure attribute.
 (gfc_match_formal_arglist): For a module procedure keep the
 interface formal_arglist from the interface, match new the
 formal arguments and then compare the number and names of each.
 (gfc_match_procedure): Add case COMP_SUBMODULE.
 (gfc_match_function_decl, gfc_match_subroutine_decl): Set the
 module_procedure attribute.
 (gfc_match_entry, gfc_match_end):  Add case COMP_SUBMODULE. If
 attr abr_modproc_decl is set, switch the message accordingly
 for subroutines and functions.
 (gfc_match_submod_proc): New function to match the abbreviated
 style of submodule declaration.
 * gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the
 attribute bits 'used_in_submodule' and 'module_procedure'. Add
 prototypes for the functions 'gfc_check_dummy_characteristics'
 and 'gfc_check_result_characteristics'.
 * interface.c : Add the prefix 'gfc_' to the names of functions
 'check_dummy(result)_characteristics' and all their references.
 * match.h : Add prototype for 'gfc_match_submod_proc' and
 'gfc_match_submodule'.
 * module.c (gfc_match_submodule): New function. Add handling
 for the 'module_procedure' attribute bit.
 * parse.c (decode_statement): Set attr has_'import_set' for
 the interface declaration of module procedures. Handle a match
 occurring in 'gfc_match_submod_proc' and a match for
 'submodule'.
 (gfc_enclosing_unit): Include the state COMP_SUBMODULE.
 (gfc_ascii_statement): Add END SUBMODULE.
 (accept_statement): Add ST_SUBMODULE.
 (parse_spec): Disallow statement functions in a submodule
 specification part.
 (parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE
 twice each.
 (set_syms_host_assoc): Make symbols from the ancestor module
 and submodules use associated, as required by the standard and
 set all private components public. Module procedures 'external'
 attribute bit is reset and the 'used_in_submodule' bit is set.
 (parse_module): If this is a submodule, use the ancestor module
 and submodules. Traverse the namespace, calling
 'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE.
 * parse.h : Add COMP_SUBMODULE.
 * primary.c (match_variable): Add COMP_SUBMODULE.
 * resolve.c (compare_fsyms): New function to compare the dummy
 characteristics of a module procedure with its interface.
 (resolve_fl_procedure): Compare the procedure, result and dummy
 characteristics of a module_procedure with its interface, using
 'compare_fsyms' for the dummy arguments.
 * symbol.c (gfc_add_procedure): Suppress the check for existing
 procedures in the case of a module procedure.
 (gfc_add_explicit_interface): Skip checks that must fail for
 module procedures.
 (gfc_add_type): Allow a new type to be added to module
 procedures, their results or their dummy arguments.
 * trans-decl.c (gfc_sym_mangled_function_id): Module procedures
 must always have

Re: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-25 Thread Paul Richard Thomas
Dear All,

Please find attached an updated version of the submodule patch.
Reinhold Bader uncovered a couple of bugs, which have now been fixed:
(i) IMPORT is no longer permitted in module_procedure interface
bodies, as required by F2008(C1210). Instead, import occurs
automatically; and
(ii) The end statement for the abreviated module procedure declaration
was wrong; should have been END PROCEDURE. I started introducing
COMP_MODPROC_FUNC/SUBR in the parser to fix this. However, many of the
if statement became impossibly torturous considering that there was
only one place where it matters. Therefore, I decided to add a bit
field to gfc_symbol as the least invasive way of dealing with the
problem.

The testcases were modified accordingly.

Bootstraps and regtests on FC21/x86_64 - OK for trunk?

Thanks Reinhold!

Paul

2015-06-25  Paul Thomas  pa...@gcc.gnu.org

PR fortran/52846
* decl.c (get_proc_name): Make a partially populated interface
symbol to carry the characteristics of a module procedure and
its result.
(gfc_match_import): IMPORT is not permitted in the interface
declaration of module procedures.
(match_attr_spec): Submodule variables have implicit save
attribute for F2008 onwards.
(gfc_match_prefix): Add 'module' as the a prefix and set the
module_procedure attribute.
(gfc_match_formal_arglist): For a module procedure keep the
interface formal_arglist from the interface, match new the
formal arguments and then compare the number and names of each.
(gfc_match_procedure): Add case COMP_SUBMODULE.
(gfc_match_function_decl, gfc_match_subroutine_decl): Set the
module_procedure attribute.
(gfc_match_entry, gfc_match_end):  Add case COMP_SUBMODULE. If
attr abr_modproc_decl is set, switch the message accordingly
for subroutines and functions.
(gfc_match_submod_proc): New function to match the abbreviated
style of submodule declaration.
* gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the
attribute bits 'used_in_submodule' and 'module_procedure'. Add
prototypes for the functions 'gfc_check_dummy_characteristics'
and 'gfc_check_result_characteristics'.
* interface.c : Add the prefix 'gfc_' to the names of functions
'check_dummy(result)_characteristics' and all their references.
* match.h : Add prototype for 'gfc_match_submod_proc' and
'gfc_match_submodule'.
* module.c (gfc_match_submodule): New function. Add handling
for the 'module_procedure' attribute bit.
* parse.c (decode_statement): Set attr has_'import_set' for
the interface declaration of module procedures. Handle a match
occurring in 'gfc_match_submod_proc' and a match for
'submodule'.
(gfc_enclosing_unit): Include the state COMP_SUBMODULE.
(gfc_ascii_statement): Add END SUBMODULE.
(accept_statement): Add ST_SUBMODULE.
(parse_spec): Disallow statement functions in a submodule
specification part.
(parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE
twice each.
(set_syms_host_assoc): Make symbols from the ancestor module
and submodules use associated, as required by the standard and
set all private components public. Module procedures 'external'
attribute bit is reset and the 'used_in_submodule' bit is set.
(parse_module): If this is a submodule, use the ancestor module
and submodules. Traverse the namespace, calling
'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE.
* parse.h : Add COMP_SUBMODULE.
* primary.c (match_variable): Add COMP_SUBMODULE.
* resolve.c (compare_fsyms): New function to compare the dummy
characteristics of a module procedure with its interface.
(resolve_fl_procedure): Compare the procedure, result and dummy
characteristics of a module_procedure with its interface, using
'compare_fsyms' for the dummy arguments.
* symbol.c (gfc_add_procedure): Suppress the check for existing
procedures in the case of a module procedure.
(gfc_add_explicit_interface): Skip checks that must fail for
module procedures.
(gfc_add_type): Allow a new type to be added to module
procedures, their results or their dummy arguments.
* trans-decl.c (gfc_sym_mangled_function_id): Module procedures
must always have their names mangled as if they are symbols
coming from a declaration in a module.
(gfc_finish_var_decl): Symbols with the 'used_in_submodule' bit
set are set DECL_EXTERNAL as if they were use associated.

2015-06-25  Paul Thomas  pa...@gcc.gnu.org

PR fortran/52846
* gfortran.dg/submodule_1.f90: New test
* gfortran.dg/submodule_2.f90: New test
* gfortran.dg/submodule_3.f90: New test
* gfortran.dg/submodule_4.f90: New test
* gfortran.dg/submodule_5.f90: New test

On 22 June 2015 at 14:39, Paul Richard Thomas
paul.richard.tho...@gmail.com wrote:
 Dear All,

 This patch enables submodule support in gfortran. Submodules are a
 feature of F2008 

Re: [Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-25 Thread Paul Richard Thomas
Dear Reinhold,

That looks like a very strange bug. I am out of the loop until Sunday
evening and so cannot look at it until then.

Thanks, this really helps

Paul

On 25 June 2015 at 23:21, Bader, Reinhold reinhold.ba...@lrz.de wrote:
 Looks much better.

 Attached another test case that fails compilation. The function result as 
 declared
 in the module procedure interface is not propagated to the submodule that 
 uses the
 argument/resultless form in the implementation.

 Cheers
 Reinhold

 -Ursprüngliche Nachricht-
 Von: Paul Richard Thomas [mailto:paul.richard.tho...@gmail.com]
 Gesendet: Donnerstag, 25. Juni 2015 17:16
 An: fort...@gcc.gnu.org; gcc-patches
 Cc: Damian Rouson; Tobias Burnus; salvatore.filipp...@uniroma2.it; Bader,
 Reinhold
 Betreff: Re: [Patch, fortran] PR52846 - [F2008] Support submodules

 Dear All,

 Please find attached an updated version of the submodule patch.
 Reinhold Bader uncovered a couple of bugs, which have now been fixed:
 (i) IMPORT is no longer permitted in module_procedure interface
 bodies, as required by F2008(C1210). Instead, import occurs
 automatically; and
 (ii) The end statement for the abreviated module procedure declaration
 was wrong; should have been END PROCEDURE. I started introducing
 COMP_MODPROC_FUNC/SUBR in the parser to fix this. However, many of the
 if statement became impossibly torturous considering that there was
 only one place where it matters. Therefore, I decided to add a bit
 field to gfc_symbol as the least invasive way of dealing with the
 problem.

 The testcases were modified accordingly.

 Bootstraps and regtests on FC21/x86_64 - OK for trunk?

 Thanks Reinhold!

 Paul

 2015-06-25  Paul Thomas  pa...@gcc.gnu.org

 PR fortran/52846
 * decl.c (get_proc_name): Make a partially populated interface
 symbol to carry the characteristics of a module procedure and
 its result.
 (gfc_match_import): IMPORT is not permitted in the interface
 declaration of module procedures.
 (match_attr_spec): Submodule variables have implicit save
 attribute for F2008 onwards.
 (gfc_match_prefix): Add 'module' as the a prefix and set the
 module_procedure attribute.
 (gfc_match_formal_arglist): For a module procedure keep the
 interface formal_arglist from the interface, match new the
 formal arguments and then compare the number and names of each.
 (gfc_match_procedure): Add case COMP_SUBMODULE.
 (gfc_match_function_decl, gfc_match_subroutine_decl): Set the
 module_procedure attribute.
 (gfc_match_entry, gfc_match_end):  Add case COMP_SUBMODULE. If
 attr abr_modproc_decl is set, switch the message accordingly
 for subroutines and functions.
 (gfc_match_submod_proc): New function to match the abbreviated
 style of submodule declaration.
 * gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the
 attribute bits 'used_in_submodule' and 'module_procedure'. Add
 prototypes for the functions 'gfc_check_dummy_characteristics'
 and 'gfc_check_result_characteristics'.
 * interface.c : Add the prefix 'gfc_' to the names of functions
 'check_dummy(result)_characteristics' and all their references.
 * match.h : Add prototype for 'gfc_match_submod_proc' and
 'gfc_match_submodule'.
 * module.c (gfc_match_submodule): New function. Add handling
 for the 'module_procedure' attribute bit.
 * parse.c (decode_statement): Set attr has_'import_set' for
 the interface declaration of module procedures. Handle a match
 occurring in 'gfc_match_submod_proc' and a match for
 'submodule'.
 (gfc_enclosing_unit): Include the state COMP_SUBMODULE.
 (gfc_ascii_statement): Add END SUBMODULE.
 (accept_statement): Add ST_SUBMODULE.
 (parse_spec): Disallow statement functions in a submodule
 specification part.
 (parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE
 twice each.
 (set_syms_host_assoc): Make symbols from the ancestor module
 and submodules use associated, as required by the standard and
 set all private components public. Module procedures 'external'
 attribute bit is reset and the 'used_in_submodule' bit is set.
 (parse_module): If this is a submodule, use the ancestor module
 and submodules. Traverse the namespace, calling
 'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE.
 * parse.h : Add COMP_SUBMODULE.
 * primary.c (match_variable): Add COMP_SUBMODULE.
 * resolve.c (compare_fsyms): New function to compare the dummy
 characteristics of a module procedure with its interface.
 (resolve_fl_procedure): Compare the procedure, result and dummy
 characteristics of a module_procedure with its interface, using
 'compare_fsyms' for the dummy arguments.
 * symbol.c (gfc_add_procedure): Suppress the check for existing
 procedures in the case of a module procedure.
 (gfc_add_explicit_interface): Skip checks that must fail

[Patch, fortran] PR52846 - [F2008] Support submodules

2015-06-22 Thread Paul Richard Thomas
Dear All,

This patch enables submodule support in gfortran. Submodules are a
feature of F2008 but are fully described in ISO/IEC TR 19767:2004(E).

The patch has one significant non-conformance (that I know about,
anyway!); whilst private derived type components are correctly dealt
with, symbols whose access is private within the parent module are
not. They should effectively be host associated in descendant
submodules. At present gfortran handles private access at the module
write stage. This means that when a submodule reads the module file,
there is no information present about symbols whose access was
private. Since this modification might cause significant fall-out to
existing code, I propose to submit a separate patch later on to sort
out the non-conformance. However, as required private and public
statements are not allowed in submodules.

The patch makes maximum possible leverage of existing code to handle
modules. Once the submodule is matched, the ancestor module and
submodules are first used and then all the symbols are set host
associated and private derived type components set public.

Most of the work involved matching module procedures, with both the
traditional form of declaration and the abbreviated one. I have chosen
to treat MODULE as a prefix like PURE or ELEMENTAL. This is logical
both because of the form of the declaration and because the
identification of module procedures is most easily done with an
attribute bit. With traditional procedure declarations, the procedure,
result and dummy characteristics are compared with those of the
interface declaration. The comparison of the dummy characteristics is
a bit cobbled together and might be better done by copying the
formal_namespace and it's contents to the new symbol and retaining the
old for the interface symbol. This patch leaves the old dummy symbols
in the formal namespace in the new ones in the formal arglist. I have
checked that cleanup occurs for all objects.

Note the comment in submodule_1.f90 about the possibility of
undetected recursion between procedures in different submodules. I am
not at all sure that I know how to deal with this and am open to
suggestions.

In addition, it should be noted that collisions between the names of
entities and procedures, other than module procedures are detected by
the linker at present.

Apart from this, all is very straightforward and follows the the ChangeLogs.

Thanks for testing of an early version of the patch by Damian Rouson,
Salvatore Filippone and Tobias Burnus.

Bootstrapped and regtested on FC21/x86_64 - OK for trunk?

Cheers

Paul

2015-06-22  Paul Thomas  pa...@gcc.gnu.org

PR fortran/52846
* decl.c (get_proc_name): Make a partially populated interface
symbol to carry the characteristics of a module procedure and
its result.
(match_attr_spec): Submodule variables have implicit save
attribute for F2008 onwards.
(gfc_match_prefix): Add 'module' as the a prefix and set the
module_procedure attribute.
(gfc_match_formal_arglist): For a module procedure keep the
interface formal_arglist from the interface, match new the
formal arguments and then compare the number and names of each.
(gfc_match_procedure): Add case COMP_SUBMODULE.
(gfc_match_function_decl, gfc_match_subroutine_decl): Set the
module_procedure attribute.
(gfc_match_entry, gfc_match_end):  Add case COMP_SUBMODULE.
(gfc_match_submod_proc): New function to match the abbreviated
style of submodule declaration.
* gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the
attribute bits 'used_in_submodule' and 'module_procedure'. Add
prototypes for the functions 'gfc_check_dummy_characteristics'
and 'gfc_check_result_characteristics'.
* interface.c : Add the prefix 'gfc_' to the names of functions
'check_dummy(result)_characteristics' and all their references.
* match.h : Add prototype for 'gfc_match_submod_proc' and
'gfc_match_submodule'.
* module.c (gfc_match_submodule): New function. Add handling
for the 'module_procedure' attribute bit.
* parse.c (decode_statement): Handle a match occurring in
'gfc_match_submod_proc' and a match for 'submodule'.
(gfc_enclosing_unit): Include the state COMP_SUBMODULE.
(gfc_ascii_statement): Add END SUBMODULE.
(accept_statement): Add ST_SUBMODULE.
(parse_spec): Disallow statement functions in a submodule
specification part.
(parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE
twice each.
(set_syms_host_assoc): Make symbols from the ancestor module
and submodules use associated, as required by the standard and
set all private components public. Module procedures 'external'
attribute bit is reset and the 'used_in_submodule' bit is set.
(parse_module): If this is a submodule, use the ancestor module
and submodules. Traverse the namespace, calling
'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE.
*