Skip to content

[flang][Semantics] Fix ICE when compiling a mod file with parameter w… #124285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion flang/lib/Semantics/mod-file.cpp
Original file line number Diff line number Diff line change
@@ -955,7 +955,13 @@ void ModFileWriter::PutObjectEntity(
}
}
PutEntity(
os, symbol, [&]() { PutType(os, DEREF(symbol.GetType())); },
os, symbol,
[&]() {
// Need to check if there is a TYPE on this symbol to avoid any ICE
if (details.type()) {
PutType(os, DEREF(symbol.GetType()));
}
},
getSymbolAttrsToWrite(symbol));
PutShape(os, details.shape(), '(', ')');
PutShape(os, details.coshape(), '[', ']');
14 changes: 14 additions & 0 deletions flang/test/Semantics/modfile_missing_type.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
! Test to check that this module can be compiled when an argument has no specified type
module inform
implicit none
interface normp
module subroutine normt( array,n,val,p )
integer siz
integer,optional::p
real*8 array(*)
real*8 val
end subroutine
end interface
end

Loading