D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17481 - [REG 2.069.0] synchronized: Access Violation with dmd -O on win32
Summary: [REG 2.069.0] synchronized: Access Violation with dmd -O on win32
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-08 17:39 UTC by Ivan Kazmenko
Modified: 2017-08-07 13:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ivan Kazmenko 2017-06-08 17:39:01 UTC
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/wdebefxpjvvxyqiollkw@forum.dlang.org
Comment 1 Walter Bright 2017-07-04 03:39:34 UTC
https://github.com/dlang/dmd/pull/6965
Comment 2 github-bugzilla 2017-07-09 22:28:27 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/d728c0f9ba8f762682eced7da06f8123ed4d7f71
fix Issue 17481 - [REG 2.069.0] synchronized: Access Violation with dmd -O on win32

https://github.com/dlang/dmd/commit/5fa367d499fd688d02e53afc9c2ceef31fb67619
Merge pull request #6965 from WalterBright/fix17481

fix Issue 17481 - [REG 2.069.0] synchronized: Access Violation with d…
merged-on-behalf-of: Martin Nowak <code@dawg.eu>
Comment 3 github-bugzilla 2017-07-10 11:10:56 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/d728c0f9ba8f762682eced7da06f8123ed4d7f71
fix Issue 17481 - [REG 2.069.0] synchronized: Access Violation with dmd -O on win32

https://github.com/dlang/dmd/commit/5fa367d499fd688d02e53afc9c2ceef31fb67619
Merge pull request #6965 from WalterBright/fix17481
Comment 4 github-bugzilla 2017-08-07 13:17:16 UTC
Commits pushed to newCTFE at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/d728c0f9ba8f762682eced7da06f8123ed4d7f71
fix Issue 17481 - [REG 2.069.0] synchronized: Access Violation with dmd -O on win32

https://github.com/dlang/dmd/commit/5fa367d499fd688d02e53afc9c2ceef31fb67619
Merge pull request #6965 from WalterBright/fix17481