re PR fortran/37193 ("USE mod, ONLY: i, i=>j" does not import "i")

2008-09-01  Daniel Kraft  <d@domob.eu>

	PR fortran/37193
	* module.c (read_module): Initialize use_only flag on used symbols.

2008-09-01  Daniel Kraft  <d@domob.eu>

	PR fortran/37193
	* gfortran.dg/use_rename_4.f90: New test.
	* gfortran.dg/use_rename_5.f90: New test.

From-SVN: r139866
This commit is contained in:
Daniel Kraft 2008-09-01 15:43:10 +02:00 committed by Daniel Kraft
parent 51c69ddb91
commit 3e1e5626dc
5 changed files with 57 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-09-01 Daniel Kraft <d@domob.eu>
PR fortran/37193
* module.c (read_module): Initialize use_only flag on used symbols.
2008-09-01 Daniel Kraft <d@domob.eu>
* gfc-internals.texi (F2003 OOP), (Type-bound Procedures): New chapter

View File

@ -4132,6 +4132,11 @@ read_module (void)
if (strcmp (name, p) != 0)
sym->attr.use_rename = 1;
/* We need to set the only_flag here so that symbols from the
same USE...ONLY but earlier are not deleted from the tree in
the gfc_delete_symtree above. */
sym->attr.use_only = only_flag;
/* Store the symtree pointing to this symbol. */
info->u.rsym.symtree = st;

View File

@ -1,3 +1,9 @@
2008-09-01 Daniel Kraft <d@domob.eu>
PR fortran/37193
* gfortran.dg/use_rename_4.f90: New test.
* gfortran.dg/use_rename_5.f90: New test.
2008-09-01 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37305

View File

@ -0,0 +1,22 @@
! { dg-do run }
! PR fortran/37193
! Check fix for problem with re-using the same symbol both renamed and
! plain.
MODULE m
IMPLICIT NONE
INTEGER :: i
END MODULE m
PROGRAM main
USE m, ONLY: i, j => i
IMPLICIT NONE
i = 4
j = 5
IF (i /= j) THEN
CALL abort ()
END IF
END PROGRAM main

View File

@ -0,0 +1,17 @@
! { dg-do compile }
! PR fortran/37193
! Check that renamed symbols are not accessiable uner their target name.
MODULE m
IMPLICIT NONE
INTEGER :: i
END MODULE m
PROGRAM main
USE m, ONLY: j => i
IMPLICIT NONE
i = 4 ! { dg-error "no IMPLICIT type" }
j = 5
END PROGRAM main