diff options
author | Peter Klausler <pklausler@nvidia.com> | 2025-01-31 10:52:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-31 10:52:34 -0800 |
commit | 36caa8f9e26e839daa75ad9f0d1d1934a8a8cd6c (patch) | |
tree | d723f513a83babdcecc3b906a0c855e191304a8f /flang/lib/Semantics/resolve-names-utils.cpp | |
parent | 8d8a821b78305b2e78c7f5deb7e85e6f349608e3 (diff) | |
download | llvm-36caa8f9e26e839daa75ad9f0d1d1934a8a8cd6c.zip llvm-36caa8f9e26e839daa75ad9f0d1d1934a8a8cd6c.tar.gz llvm-36caa8f9e26e839daa75ad9f0d1d1934a8a8cd6c.tar.bz2 |
[flang] Fix crash on SMP with dummy procedure (#124663)
When a separate module procedure is defined with MODULE PROCEDURE, the
compiler crashes if there is a dummy procedure in the interface defined
with only a result type. This is due to the type already having been
defined on the ProcEntityDetails symbol as part of earlier wholesale
symbol duplication. Adjust the code to not define the result type of the
ProcEntityDetails if it is already present, but to verify that it is the
same type instead.
Fixes https://github.com/llvm/llvm-project/issues/124487.
Diffstat (limited to 'flang/lib/Semantics/resolve-names-utils.cpp')
-rw-r--r-- | flang/lib/Semantics/resolve-names-utils.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/flang/lib/Semantics/resolve-names-utils.cpp b/flang/lib/Semantics/resolve-names-utils.cpp index a838d49..347f54e0 100644 --- a/flang/lib/Semantics/resolve-names-utils.cpp +++ b/flang/lib/Semantics/resolve-names-utils.cpp @@ -762,7 +762,11 @@ void SymbolMapper::MapSymbolExprs(Symbol &symbol) { proc.set_procInterfaces( *mappedSymbol, BypassGeneric(mappedSymbol->GetUltimate())); } else if (const DeclTypeSpec * mappedType{MapType(proc.type())}) { - proc.set_type(*mappedType); + if (proc.type()) { + CHECK(*proc.type() == *mappedType); + } else { + proc.set_type(*mappedType); + } } if (proc.init()) { if (const Symbol * mapped{MapSymbol(*proc.init())}) { |