Skip to content

Substitution of DataSymbols is buggy when multiple symbols with the same name are present #2511

@EdCaunt

Description

@EdCaunt

MFE:

from devito.types.basic import DataSymbol
s0 = DataSymbol(name='s')
s1 = DataSymbol(name='s')

s2 = s0._rebuild(name='s2')
s3 = s1._rebuild(name='s3')

# Causes s1 to be incorrectly substituted
# mapper = {s0: s2, s1: s3}
# Causes s0 to be incorrectly substituted
mapper = {s1: s3, s0: s2}

print(s0.subs(mapper))
print(mapper[s0])

print(s1.subs(mapper))
print(mapper[s1])

Returns

s3
s2
s3
s3

rather than

s2
s2
s3
s3

This line is a potential culprit for this behaviour. #2510 features a workaround in the context of concretisation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions