* Re: [patch, fortran] Fix PR 52668, bogus warning for only list
@ 2012-04-05 8:54 Tobias Burnus
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2012-04-05 8:54 UTC (permalink / raw)
To: Thomas Koenig, gcc-patches, fortran
Thomas Koenig wrote:
> this fixes a 4.7/4.8 regression with a bogus warning for variables
> which were excluded from being imported by "use, only" if they
> were in a common block inside the module.
>
> Regression-tested. OK for trunk and for 4.7 after a few days?
OK and thanks for the patch.
> ! { dg-final { cleanup-modules "mm" } }
I think due to Bernhard's patch, this line is no longer needed.
Cf. http://gcc.gnu.org/ml/fortran/2012-03/msg00069.html and
the unreviewed patch at http://gcc.gnu.org/ml/fortran/2012-04/msg00002.html
Tobias
^ permalink raw reply [flat|nested] 2+ messages in thread
* [patch, fortran] Fix PR 52668, bogus warning for only list
@ 2012-03-25 9:28 Thomas Koenig
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Koenig @ 2012-03-25 9:28 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
Hello world,
this fixes a 4.7/4.8 regression with a bogus warning for variables
which were excluded from being imported by "use, only" if they
were in a common block inside the module.
Regression-tested. OK for trunk and for 4.7 after a few days?
Thomas
2012-03-25 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-03-25 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/52668
* gfortran.dg/use_only_6.f90: New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 909 bytes --]
Index: module.c
===================================================================
--- module.c (Revision 184854)
+++ module.c (Arbeitskopie)
@@ -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;
[-- Attachment #3: use_only_6.f90 --]
[-- Type: text/plain, Size: 305 bytes --]
! { dg-do compile }
! PR 52668 - there used to be a bogus warning about not using b.
! Original test case by Arnaud Desitter.
module mm
integer :: a, b
common /mm1/ a, b
end module mm
subroutine aa()
use mm, only: a
implicit none
a = 1
end subroutine aa
! { dg-final { cleanup-modules "mm" } }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-05 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 8:54 [patch, fortran] Fix PR 52668, bogus warning for only list Tobias Burnus
-- strict thread matches above, loose matches on Subject: below --
2012-03-25 9:28 Thomas Koenig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).