diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-04-06 18:31:11 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-04-06 18:31:11 +0000 |
commit | 631cfe30838acc834c38a7ce89339e144f49000f (patch) | |
tree | e9fae2ca038d08d08fb64a68e8ee0475e0814346 /gcc/fortran/module.c | |
parent | 5f250b068e74cb7b6170ae033f725a9e4ce3af1c (diff) | |
download | gcc-631cfe30838acc834c38a7ce89339e144f49000f.zip gcc-631cfe30838acc834c38a7ce89339e144f49000f.tar.gz gcc-631cfe30838acc834c38a7ce89339e144f49000f.tar.bz2 |
re PR fortran/52668 (Incorrect unused warning for USE associating variable in common block)
2012-04-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/52668
* module.c: Only mark symbols as use_only if they have been
imported via an only list.
2012-04-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/52668
* gfortran.dg/use_only_6.f90: New test.
From-SVN: r186199
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 05ed2a2..60a74ca 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4389,9 +4389,24 @@ load_needed (pointer_info *p) /* Mark as only or rename for later diagnosis for explicitly imported but not used warnings; don't mark internal symbols such as __vtab, - __def_init etc. */ + __def_init etc. Only mark them if they have been explicitly loaded. */ + if (only_flag && sym->name[0] != '_' && sym->name[1] != '_') - sym->attr.use_only = 1; + { + gfc_use_rename *u; + + /* Search the use/rename list for the variable; if the variable is + found, mark it. */ + for (u = gfc_rename_list; u; u = u->next) + { + if (strcmp (u->use_name, sym->name) == 0) + { + sym->attr.use_only = 1; + break; + } + } + } + if (p->u.rsym.renamed) sym->attr.use_rename = 1; |