www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17481] New: [REG 2.069.0] synchronized: Access Violation with

https://issues.dlang.org/show_bug.cgi?id=17481

          Issue ID: 17481
           Summary: [REG 2.069.0] synchronized: Access Violation with dmd
                    -O on win32
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: gassa mail.ru

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

--
Jun 08