This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR47203 Use of module with same name as subroutine


Hello,

a small, unexciting bug.
For the case:

   subroutine m()
      use m
   end subroutine m

the USE statement is rejected, but it is not if the subroutine is contained.
In the latter case, the namespace of the symbol of the subroutine is the parent namespace, which confuses the error condition in check_for_ambiguous.


Regression tested on x86_64-unknown-linux-gnu. OK for trunk?

Mikael

Attachment: pr47203.CL
Description: Text document

Attachment: pr47203.diff
Description: Text document

Attachment: pr47203-test.CL
Description: Text document

! { dg-do compile }
!
! PR fortran/47203
! The USE statement of a module was not rejected in a procedure with the same
! name if the procedure was contained.
!
! Contributed by Tobias Burnus <burnus@net-b.de>

module m
end module m

call m
contains
  subroutine m()
     use m      ! { dg-error "is also the name of the current program unit" }
  end subroutine m
end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]