aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2009-01-17 11:58:48 +0000
committerPaul Thomas <pault@gcc.gnu.org>2009-01-17 11:58:48 +0000
commite775e6b69761811ccd6a4034275eee019f410f65 (patch)
tree0c9411f4507eb86dfeb2d2ba72500e57179dd827 /gcc/fortran/module.c
parentc41fea4af48ddaeeef4c043d874c8c333d669849 (diff)
downloadgcc-e775e6b69761811ccd6a4034275eee019f410f65.zip
gcc-e775e6b69761811ccd6a4034275eee019f410f65.tar.gz
gcc-e775e6b69761811ccd6a4034275eee019f410f65.tar.bz2
re PR fortran/38657 (PUBLIC/PRIVATE Common blocks)
2009-01-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/38657 * module.c (write_common_0): Add argument 'this_module' and check that non-use associated common blocks are written first. (write_common): Call write_common_0 twice, once with true and then with false. 2009-01-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/38657 * gfortran.dg/module_commons_3.f90: Reapply. From-SVN: r143463
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 3ae5929..09c3e20 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4333,7 +4333,7 @@ free_written_common (struct written_common *w)
/* Write a common block to the module -- recursive helper function. */
static void
-write_common_0 (gfc_symtree *st)
+write_common_0 (gfc_symtree *st, bool this_module)
{
gfc_common_head *p;
const char * name;
@@ -4345,7 +4345,7 @@ write_common_0 (gfc_symtree *st)
if (st == NULL)
return;
- write_common_0 (st->left);
+ write_common_0 (st->left, this_module);
/* We will write out the binding label, or the name if no label given. */
name = st->n.common->name;
@@ -4364,6 +4364,9 @@ write_common_0 (gfc_symtree *st)
w = (c < 0) ? w->left : w->right;
}
+ if (this_module && p->use_assoc)
+ write_me = false;
+
if (write_me)
{
/* Write the common to the module. */
@@ -4389,7 +4392,7 @@ write_common_0 (gfc_symtree *st)
gfc_insert_bbt (&written_commons, w, compare_written_commons);
}
- write_common_0 (st->right);
+ write_common_0 (st->right, this_module);
}
@@ -4400,7 +4403,8 @@ static void
write_common (gfc_symtree *st)
{
written_commons = NULL;
- write_common_0 (st);
+ write_common_0 (st, true);
+ write_common_0 (st, false);
free_written_common (written_commons);
written_commons = NULL;
}