Bug 23158 – synchronized class data is not locked in free function in same module

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2022-06-04T17:01:49Z
Last change time
2024-12-13T19:23:18Z
Assigned to
No Owner
Creator
Nick Treleaven
Moved to GitHub: dmd#18110 →

Comments

Comment #0 by nick — 2022-06-04T17:01:49Z
synchronized class C { private int i; } public void foo(C c) { c.i++; } $ dmd -vasm -c old/syncclass.d _D9syncclass3fooFCQq1CZv: 0000: FF 40 08 inc dword ptr 8[EAX] 0003: C3 ret foo just incremented `c.i` without locking `c`. Field access should probably be an error outside a `synchronized (c)` statement, unless `c` is `shared`.
Comment #1 by robert.schadek — 2024-12-13T19:23:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18110 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB