diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -427,6 +427,7 @@ PutGenericName(uses_ << "=>", use); } uses_ << '\n'; + PutUseExtraAttr(Attr::PRIVATE, symbol, use); PutUseExtraAttr(Attr::VOLATILE, symbol, use); PutUseExtraAttr(Attr::ASYNCHRONOUS, symbol, use); } diff --git a/flang/test/Semantics/modfile03.f90 b/flang/test/Semantics/modfile03.f90 --- a/flang/test/Semantics/modfile03.f90 +++ b/flang/test/Semantics/modfile03.f90 @@ -158,3 +158,21 @@ ! end ! end interface !end + +module m7a + real :: x +end +!Expect: m7a.mod +!module m7a +! real(4)::x +!end + +module m7b + use m7a + private +end +!Expect: m7b.mod +!module m7b +! use m7a,only:x +! private::x +!end