aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2009-01-05 19:46:06 +0000
committerPaul Thomas <pault@gcc.gnu.org>2009-01-05 19:46:06 +0000
commitc73140776c32f78f9c7828a5cd8b930680da8b08 (patch)
tree3fe6065b40a6a4f61b66b6efc8ba9b66d6fb4a8d /gcc/fortran/module.c
parentb55c4f04b3ede3f0b299553e6de822e7d63d2ea5 (diff)
downloadgcc-c73140776c32f78f9c7828a5cd8b930680da8b08.zip
gcc-c73140776c32f78f9c7828a5cd8b930680da8b08.tar.gz
gcc-c73140776c32f78f9c7828a5cd8b930680da8b08.tar.bz2
re PR fortran/38657 (PUBLIC/PRIVATE Common blocks)
2009-01-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/38657 * module.c (write_common_0): Use the name of the symtree rather than the common block, to determine if the common has been written. 2009-01-05 Paul Thomas <pault@gcc.gnu.org> PR fortran/38657 * gfortran.dg/module_commons_3.f90: New test. From-SVN: r143090
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 1b32ee2..7bbfa12 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4337,6 +4337,7 @@ write_common_0 (gfc_symtree *st)
{
gfc_common_head *p;
const char * name;
+ const char * lname;
int flags;
const char *label;
struct written_common *w;
@@ -4349,6 +4350,9 @@ write_common_0 (gfc_symtree *st)
/* We will write out the binding label, or the name if no label given. */
name = st->n.common->name;
+
+ /* Use the symtree(local)name to check if the common has been written. */
+ lname = st->name;
p = st->n.common;
label = p->is_bind_c ? p->binding_label : p->name;
@@ -4356,7 +4360,7 @@ write_common_0 (gfc_symtree *st)
w = written_commons;
while (w)
{
- int c = strcmp (name, w->name);
+ int c = strcmp (lname, w->name);
c = (c != 0 ? c : strcmp (label, w->label));
if (c == 0)
write_me = false;
@@ -4384,7 +4388,7 @@ write_common_0 (gfc_symtree *st)
/* Record that we have written this common. */
w = XCNEW (struct written_common);
- w->name = p->name;
+ w->name = lname;
w->label = label;
gfc_insert_bbt (&written_commons, w, compare_written_commons);
}