Bug 17481 – [REG 2.069.0] synchronized: Access Violation with dmd -O on win32
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2017-06-08T17:39:00Z
Last change time
2017-08-07T13:17:16Z
Assigned to
nobody
Creator
gassa
Comments
Comment #0 by gassa — 2017-06-08T17:39:01Z
Code:
-----
class Obj{
synchronized void trigger(){ new ubyte[1]; }
}
void main(){
auto k = new shared Obj;
k.trigger;
}
-----
When compiled on win32 with just "dmd", it runs fine.
When compiled with "dmd -O -g", it gives the following error at runtime:
-----
object.Error@(0): Access Violation
----------------
0x00000065
0x00402C6B in _d_newarrayU
0x004023EF in _d_newarrayT
0x00402A7F in scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x00402980 in _d_run_main
0x00402288 in main at C:\programs\stuff\dlang\synchronized-memory-bug\a.d(8)
0x76D5336A in BaseThreadInitThunk
0x77369902 in RtlInitializeExceptionChain
0x773698D5 in RtlInitializeExceptionChain
-----
Win64 is OK. Win32 with dmd 2.068.2 or earlier is OK. Win32 with dmd 2.069.0 or later gives the error above.
Original thread at D.learn:
https://forum.dlang.org/post/[email protected]