re PR fortran/33818 (Bogus error "Variable 'str' is used at (1) before the ENTRY statement")

2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * resolve.c (resolve_variable): Check that symbol is in the same
        namespace as the entry function.

2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * gfortran.dg/entry_dummy_ref_3.f90: New.

From-SVN: r129510
This commit is contained in:
Tobias Burnus 2007-10-20 13:34:21 +02:00 committed by Tobias Burnus
parent 85799c607b
commit 70365b5c3d
4 changed files with 39 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2007-10-20 Tobias Burnus <burnus@net-b.de>
PR fortran/33818
* resolve.c (resolve_variable): Check that symbol is in the same
namespace as the entry function.
2007-10-20 Paul Thomas <pault@gcc.gnu.org>
FX Coudert <fxcoudert@gcc.gnu.org>

View File

@ -3935,7 +3935,7 @@ resolve_variable (gfc_expr *e)
bool seen;
/* If the symbol is a dummy... */
if (sym->attr.dummy)
if (sym->attr.dummy && sym->ns == gfc_current_ns)
{
entry = gfc_current_ns->entries;
seen = false;
@ -3952,8 +3952,8 @@ resolve_variable (gfc_expr *e)
if (!seen)
{
if (specification_expr)
gfc_error ("Variable '%s',used in a specification expression, "
"is referenced at %L before the ENTRY statement "
gfc_error ("Variable '%s', used in a specification expression"
", is referenced at %L before the ENTRY statement "
"in which it is a parameter",
sym->name, &cs_base->current->loc);
else

View File

@ -1,3 +1,8 @@
2007-10-20 Tobias Burnus <burnus@net-b.de>
PR fortran/33818
* gfortran.dg/entry_dummy_ref_3.f90: New.
2007-10-20 Paul Thomas <pault@gcc.gnu.org>
FX Coudert <fxcoudert@gcc.gnu.org>

View File

@ -0,0 +1,25 @@
! { dg-do compile }
!
! PR fortran/33818
!
subroutine ExportZMX(lu)
implicit none
integer :: lu
interface
function LowerCase(str)
character(*),intent(in) :: str
character(len(str)) :: LowerCase
end function LowerCase
end interface
character(*),parameter :: UNAME(1:1)=(/'XXX'/)
write(lu,'(a)') 'UNIT '//UpperCase(UNAME(1))
write(lu,'(a)') 'Unit '//LowerCase(UNAME(1))
entry ExportSEQ(lu)
contains
function UpperCase(str) result(res)
character(*),intent(in) :: str
character(len(str)) res
res=str
end function
end