Issue 124731
Summary [flang] issue with submodules usage
Labels flang
Assignees
Reporter shivaramaarao
    consider the following program 
reference: 
https://www.ibm.com/docs/en/openxl-fortran-aix/17.1.1?topic=procedures-submodules-fortran-2008

MODULE m1
  TYPE Base
    INTEGER :: i
  END TYPE

  INTERFACE
    MODULE SUBROUTINE sub1(i, b)   ! Module procedure interface body for sub1
 INTEGER, INTENT(IN) :: i
      TYPE(Base), INTENT(IN) :: b
    END SUBROUTINE
  END INTERFACE
END MODULE

MODULE m4
  USE m1 ! Use association of module m1
  TYPE, EXTENDS(Base) :: NewType
 REAL :: j
  END TYPE
END MODULE


SUBMODULE (m1) m1sub
  USE m4 ! Use association of module m4

  CONTAINS
    MODULE SUBROUTINE sub1(i, b)   ! Implementation of sub1 declared in m1
 INTEGER, INTENT(IN) :: i
      TYPE(Base), INTENT(IN) :: b
      PRINT *, "sub1", i, b
    END SUBROUTINE
END SUBMODULE


flang issues the following error when compiling this testcase.

$flang rep4.f90
error: Semantic errors in rep4.f90
./rep4.f90:23:7: error: Cannot use-associate 'sub1'; it is already declared in this scope
    USE m4 ! Use association of module m4
        ^^
./rep4.f90:26:23: Previous declaration of 'sub1'
      MODULE SUBROUTINE sub1(i, b)   ! Implementation of sub1 declared in m1

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to