Skip to content

[flang] renamed specific shadowed by generic cause error when reading module files #83836

Closed
@jeanPerier

Description

@jeanPerier

Reproducer:

modules.f90 :

module mod0
    interface proc
      module procedure  proc
    end interface
contains
  subroutine proc(n)
    print *, n
  end subroutine
end module
module mod1
  use mod0,renamed_proc=>proc
  procedure(renamed_proc),pointer :: p
end module

main.f90 :

  use mod1
  p => renamed_proc
  call p(343)
end program
flang-new -c modules.f90
flang-new -c main.f90

Bogus error:

error: Semantic errors in main.f90
./main.f90:2:3: error: 'proc' is not a procedure
    p => renamed_proc
    ^^^^^^^^^^^^^^^^^
./main.f90:2:3: error: In assignment to object pointer 'p', the target 'proc' is a procedure designator
    p => renamed_proc
    ^^^^^^^^^^^^^^^^^
./mod1.mod:5:26: Declaration of 'p'
  procedure(proc),pointer::p
                           ^
./main.f90:3:3: error: 'proc' is not a procedure
    call p(343)
    ^^^^^^^^^^^
./mod1.mod:5:11: error: 'proc' must be an abstract interface or a procedure with an explicit interface
  procedure(proc),pointer::p

This test is derived from discussions in #81544 and was not fixed by #82837.

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions