Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
// constant attribute of [hl]fir.declare/fircg.ext_declare operation that has
// a dummy_scope operand).
unsigned argNo = 0;
if (fir::isDummyArgument(declOp.getMemref())) {
auto arg = llvm::cast<mlir::BlockArgument>(declOp.getMemref());
argNo = arg.getArgNumber() + 1;
if (declOp.getDummyScope()) {
if (auto arg = llvm::dyn_cast<mlir::BlockArgument>(declOp.getMemref()))
argNo = arg.getArgNumber() + 1;
}

auto tyAttr = typeGen.convertType(fir::unwrapRefType(declOp.getType()),
Expand Down
12 changes: 12 additions & 0 deletions flang/test/Integration/debug-116525.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
! RUN: %flang_fc1 -fopenmp -emit-llvm -debug-info-kind=standalone %s -o -

! Test that this does not cause build failure.
function s(x)
character(len=2) :: x, s, ss

s = x

entry ss()

end function s

Loading