You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin19.6.0
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: a764d3d654f40738ef4fa3561f9864c0
Issue Description:
If I have a tuple stored property in a class and I pass an inout reference to one of the tuple's members to another function, if that function accesses (directly or indirectly) a different member of the same tuple, this produces an exclusive memory access violation.
This is rather surprising to me, it's a stored property with no property observers so I wouldn't expect accessing its members individually to behave any differently than storing the elements in separate properties. It looks like it does this because it's going through a synthesized tup.modify accessor.
Simultaneous accesses to 0x7ffd4ec05ed0, but modification requires exclusive access.
Previous access (a modification) started at main`Foo.tup.modify + 43 (0x100da5a4b).
Current access (a modification) started at:
0 libswiftCore.dylib 0x00007fff71452750 swift_beginAccess + 568
1 main 0x0000000100da5a20 Foo.tup.modify + 43
2 main 0x0000000100da5ad0 Foo.bar(_:) + 47
3 main 0x0000000100da5a70 Foo.foo() + 74
4 main 0x0000000100da57d0 main + 54
5 libdyld.dylib 0x00007fff71b36cc8 start + 1
Fatal access conflict detected.
The text was updated successfully, but these errors were encountered:
This is expected behavior. An "access" is always considered to the whole class property, even if only a sub-element (or sub-struct-field) is actually used.
Environment
Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin19.6.0
Additional Detail from JIRA
md5: a764d3d654f40738ef4fa3561f9864c0
Issue Description:
If I have a tuple stored property in a class and I pass an inout reference to one of the tuple's members to another function, if that function accesses (directly or indirectly) a different member of the same tuple, this produces an exclusive memory access violation.
This is rather surprising to me, it's a stored property with no property observers so I wouldn't expect accessing its members individually to behave any differently than storing the elements in separate properties. It looks like it does this because it's going through a synthesized
tup.modify
accessor.This produces
The text was updated successfully, but these errors were encountered: