diff --git a/loki/frontend/fparser.py b/loki/frontend/fparser.py index 6fd54b08c..dba5911d2 100644 --- a/loki/frontend/fparser.py +++ b/loki/frontend/fparser.py @@ -1812,11 +1812,12 @@ def visit_Subroutine_Subprogram(self, o, **kwargs): rescope_symbols=True, source=source, incomplete=False ) - # Once statement functions are in place, we need to update the original declaration symbol + # Once statement functions are in place, we need to update the original declaration so that it + # contains ProcedureSymbols rather than Scalars for decl in FindNodes(ir.VariableDeclaration).visit(spec): if any(routine.symbol_attrs[s.name].is_stmt_func for s in decl.symbols): - assert all(routine.symbol_attrs[s.name].is_stmt_func for s in decl.symbols) - decl._update(symbols=tuple(s.clone() for s in decl.symbols)) + decl._update(symbols=tuple(s.clone() if routine.symbol_attrs[s.name].is_stmt_func else s + for s in decl.symbols)) # Big, but necessary hack: # For deferred array dimensions on allocatables, we infer the conceptual diff --git a/tests/test_subroutine.py b/tests/test_subroutine.py index f6df24a24..8c4817d06 100644 --- a/tests/test_subroutine.py +++ b/tests/test_subroutine.py @@ -1493,8 +1493,7 @@ def test_subroutine_stmt_func(here, frontend): integer, intent(in) :: a integer, intent(out) :: b integer :: array(a) - integer :: i, j - integer :: plus, minus + integer :: i, j, plus, minus plus(i, j) = i + j minus(i, j) = i - j integer :: mult