DMD [-O flag] vs. [memory allocation in a synchronized class]

Ivan Kazmenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 8 08:35:06 PDT 2017


On Thursday, 8 June 2017 at 11:41:40 UTC, realhet wrote:
> I've managed to narrow the problem even more:
>
> //win32 dmd -O
>
> class Obj{
>   synchronized void trigger(){ new ubyte[1]; }
> }
>
> void main(){
>   auto k = new shared Obj;
>   k.trigger;
> }
>
> This time I got a more sophisticated error message:
>
> object.Error@(0): Access Violation
> ----------------
> 0x7272456D in SymInitialize
> 0x00402667
> 0x00402A97
> 0x00402998
> 0x004022A0
> 0x76F13744 in BaseThreadInitThunk
> 0x773B9E54 in RtlSetCurrentTransaction
> 0x773B9E1F in RtlSetCurrentTransaction

I can reproduce this under win32, and it breaks somewhere between 
2.068.2 and 2.069.0.

The move instructive message with "dmd -O -g":

object.Error@(0): Access Violation
----------------
0x00000065
0x00402C33 in _d_newarrayU
0x004022EB 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:\a.d(8)
0x757F336A in BaseThreadInitThunk
0x77409902 in RtlInitializeExceptionChain
0x774098D5 in RtlInitializeExceptionChain

Perhaps a regression should be filed, or searched for, at 
issues.dlang.org.  I can do it, but not right now, and would be 
glad if someone beats me to it.

Ivan Kazmenko.



More information about the Digitalmars-d-learn mailing list