Issue 124716
Summary [flang] issue with submodule usage
Labels flang
Assignees
Reporter shivaramaarao
    Consider the following files

rep1.f90
----------
MODULE m1
  INTERFACE
 MODULE SUBROUTINE sub1(N, ARR) 
      INTEGER, INTENT(IN) :: N
 INTEGER, DIMENSION(N) :: ARR
    END SUBROUTINE
  END INTERFACE
END MODULE

rep2.f90
---------
SUBMODULE (m1) m1sub
  CONTAINS
    MODULE SUBROUTINE sub1(N, ARR) 
      INTEGER, INTENT(IN) :: N
      INTEGER, DIMENSION(N) :: ARR
     PRINT *, "sub1", N, ARR
    END SUBROUTINE
END SUBMODULE

rep3.f90
---------
SUBMODULE (m1:m1sub) mym1sub
END SUBMODULE

$ flang -c rep1.f90
$ flang -c rep2.f90
$ flang -c rep3.f90
error: Semantic errors in rep3.f90
./m1-m1sub.mod:3:13: error: 'n' not found in module 'm1'
  use m1,only:n
 ^
./m1-m1sub.mod:4:1: error: PRIVATE statement may only appear in the specification part of a module
  private::n
  ^^^^^^^^^^

The file m1-m1sub.mod has following content, that is incorrect
submodule(m1) m1sub
use m1,only:n
private::n


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

Reply via email to