mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-10-09 20:34:54 +00:00
[flang] Fix crash with alternate returns in modules
Summary: We weren't handling the case of subroutines with alternate returns that are contained in modules. I changed the code to add an `*` as the name of the parameter when creating the `.mod` file. Reviewers: tskeith, klausler, DavidTruby Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D82096
This commit is contained in:
parent
2d865ccbd8
commit
3ed2909feb
@ -322,7 +322,11 @@ void ModFileWriter::PutSubprogram(const Symbol &symbol) {
|
||||
if (n++ > 0) {
|
||||
os << ',';
|
||||
}
|
||||
os << dummy->name();
|
||||
if (dummy) {
|
||||
os << dummy->name();
|
||||
} else {
|
||||
os << "*";
|
||||
}
|
||||
}
|
||||
os << ')';
|
||||
PutAttrs(os, bindAttrs, details.bindName(), " "s, ""s);
|
||||
@ -825,7 +829,9 @@ void SubprogramSymbolCollector::Collect() {
|
||||
const auto &details{symbol_.get<SubprogramDetails>()};
|
||||
isInterface_ = details.isInterface();
|
||||
for (const Symbol *dummyArg : details.dummyArgs()) {
|
||||
DoSymbol(DEREF(dummyArg));
|
||||
if (dummyArg) {
|
||||
DoSymbol(*dummyArg);
|
||||
}
|
||||
}
|
||||
if (details.isFunction()) {
|
||||
DoSymbol(details.result());
|
||||
|
@ -39,6 +39,15 @@ contains
|
||||
end
|
||||
end
|
||||
|
||||
! Module with a subroutine with alternate returns
|
||||
module m3
|
||||
contains
|
||||
subroutine altReturn(arg1, arg2, *, *)
|
||||
real :: arg1
|
||||
real :: arg2
|
||||
end subroutine
|
||||
end module m3
|
||||
|
||||
!Expect: m1.mod
|
||||
!module m1
|
||||
!type::t
|
||||
@ -73,3 +82,12 @@ end
|
||||
!complex(4)::x
|
||||
!end
|
||||
!end
|
||||
|
||||
!Expect: m3.mod
|
||||
!module m3
|
||||
!contains
|
||||
!subroutine altreturn(arg1,arg2,*,*)
|
||||
!real(4)::arg1
|
||||
!real(4)::arg2
|
||||
!end
|
||||
!end
|
||||
|
Loading…
Reference in New Issue
Block a user