digitalmars.D.learn - DMD [-O flag] vs. [memory allocation in a synchronized class]
- realhet (15/15) Jun 08 2017 Hi,
- ketmar (1/1) Jun 08 2017 worksforme with -O, and with -O -inline.
- realhet (3/4) Jun 08 2017 I forgot to mention, that I'm generating win32 output.
- ketmar (2/6) Jun 08 2017 mine: GNU/Linux, 32 bit, dmd git HEAD.
- realhet (20/20) Jun 08 2017 I've managed to narrow the problem even more:
- Ivan Kazmenko (20/40) Jun 08 2017 I can reproduce this under win32, and it breaks somewhere between
- Ivan Kazmenko (2/5) Jun 08 2017 Reported: https://issues.dlang.org/show_bug.cgi?id=17481
- realhet (2/3) Jun 09 2017 Thank You!
Hi, This code works well with the unoptimized compilation with DMD. import std.array; synchronized class Obj{ private int[] arr; void trigger(){ arr.length += 1; } } void main(){ auto k = new shared Obj; k.trigger; } And when I use the -O option, it shows the following error in the trigger() method: core.exception.InvalidMemoryOperationError src\core\exception.d(696): Invalid memory operation Why? o.O
Jun 08 2017
On Thursday, 8 June 2017 at 10:48:41 UTC, ketmar wrote:worksforme with -O, and with -O -inline.I forgot to mention, that I'm generating win32 output. DMD32 D Compiler v2.074.0
Jun 08 2017
realhet wrote:On Thursday, 8 June 2017 at 10:48:41 UTC, ketmar wrote:mine: GNU/Linux, 32 bit, dmd git HEAD.worksforme with -O, and with -O -inline.I forgot to mention, that I'm generating win32 output. DMD32 D Compiler v2.074.0
Jun 08 2017
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
Jun 08 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 RtlSetCurrentTransactionI 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.
Jun 08 2017
On Thursday, 8 June 2017 at 15:35:06 UTC, Ivan Kazmenko wrote: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.Reported: https://issues.dlang.org/show_bug.cgi?id=17481
Jun 08 2017
On Thursday, 8 June 2017 at 17:39:41 UTC, Ivan Kazmenko wrote:Reported: https://issues.dlang.org/show_bug.cgi?id=17481Thank You!
Jun 09 2017