Skip to content

Commit

Permalink
Extract: Ensure correct re-scoping after cloning arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Oct 19, 2024
1 parent f28bf69 commit 1987b85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion loki/transformations/extract/outline.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def outline_region(region, name, imports, intent_map=None):
local_var = region_routine_var_map.get(arg.name, arg)
# Sanitise argument types
local_var = local_var.clone(
type=local_var.type.clone(intent=intent, allocatable=None, target=None)
type=local_var.type.clone(intent=intent, allocatable=None, target=None),
scope=region_routine
)

region_routine_var_map[arg.name] = local_var
Expand All @@ -143,6 +144,9 @@ def outline_region(region, name, imports, intent_map=None):
region_routine.variables = region_routine_arguments + region_routine_locals
region_routine.arguments = region_routine_arguments

# Ensure everything has been rescoped
region_routine.rescope_symbols()

# Create the call according to the wrapped code region
call_arg_map = {v.name: v for v in region_in_args + region_inout_args + region_out_args}
call_arguments = tuple(call_arg_map[a.name] for a in region_routine_arguments)
Expand Down

0 comments on commit 1987b85

Please sign in to comment.