diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-11 06:07:51 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-11 06:07:51 +0000 |
commit | 7f343dad554f0166f664cba7d6ab809ee4473f13 (patch) | |
tree | 5f549f9387f37ae57d7747549dd4403b83905370 /gcc/fortran | |
parent | efdfa4676cd3506381bd987f7365767bb05c934a (diff) | |
download | gcc-7f343dad554f0166f664cba7d6ab809ee4473f13.tar.gz |
2016-02-11 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9
svn merge -r227821:227910 ^/trunk
}}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@233315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/fortran/gfortran.texi | 8 | ||||
-rw-r--r-- | gcc/fortran/module.c | 13 |
3 files changed, 32 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 13bb7b3fd63..ee6db56529d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2015-09-17 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/52846 + PR fortran/67588 + * module.c : Add static no_module_procedures. + (gfc_match_submodule): Correct memory leakage caused during the + freeing of use_lists. + (mio_symbol_attribute): Reset above if module procedure is + encountered. + (gfc_dump_module): Set above and exit without writing smod file + if it reset. + * gfortran.texi : Add section on submodule support. + 2015-09-10 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67526 diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index e15d6e6605b..876f22663d5 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -1047,6 +1047,14 @@ of @code{ISO_FORTRAN_ENV}. and experimental support for multiple images with the @option{-fcoarray=lib} flag. +@item Submodules are supported. It should noted that @code{MODULEs} do not +produce the smod file needed by the descendent @code{SUBMODULEs} unless they +contain at least one @code{MODULE PROCEDURE} interface. The reason for this is +that @code{SUBMODULEs} are useless without @code{MODULE PROCEDUREs}. See +http://j3-fortran.org/doc/meeting/207/15-209.txt for a discussion and a draft +interpretation. Adopting this interpretation has the advantage that code that +does not use submodules does not generate smod files. + @item The @code{DO CONCURRENT} construct is supported. @item The @code{BLOCK} construct is supported. diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 572bd501370..30ed56a2539 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -193,6 +193,11 @@ static gzFile module_fp; static const char *module_name; /* The name of the .smod file that the submodule will write to. */ static const char *submodule_name; + +/* Suppress the output of a .smod file by module, if no module + procedures have been seen. */ +static bool no_module_procedures; + static gfc_use_list *module_list; /* If we're reading an intrinsic module, this is its ID. */ @@ -798,7 +803,7 @@ gfc_match_submodule (void) /* Just retain the ultimate .(s)mod file for reading, since it contains all the information in its ancestors. */ use_list = module_list; - for (; module_list->next; use_list = use_list->next) + for (; module_list->next; use_list = module_list) { module_list = use_list->next; free (use_list); @@ -2224,7 +2229,10 @@ mio_symbol_attribute (symbol_attribute *attr) if (attr->array_outer_dependency) MIO_NAME (ab_attribute) (AB_ARRAY_OUTER_DEPENDENCY, attr_bits); if (attr->module_procedure) + { MIO_NAME (ab_attribute) (AB_MODULE_PROCEDURE, attr_bits); + no_module_procedures = false; + } mio_rparen (); @@ -6083,9 +6091,10 @@ gfc_dump_module (const char *name, int dump_flag) else dump_smod =false; + no_module_procedures = true; dump_module (name, dump_flag); - if (dump_smod) + if (no_module_procedures || dump_smod) return; /* Write a submodule file from a module. The 'dump_smod' flag switches |