www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What wrong?

reply "Fyodor Ustinov" <ufm ufm.su> writes:
Simple code:

http://pastebin.com/raw.php?i=7jVeMFXQ

This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based
on DMD v2.066.1 and LLVM 3.5.0.

$ ./z
TUQLUE
42
11

Compiled by DMD v2.067.1 the program crashes:
$ ./aa
TUQLUE
Segmentation fault

What I'm doing wrong?
May 04 2015
next sibling parent Daniel =?UTF-8?B?S296w6Fr?= via Digitalmars-d writes:
On Mon, 04 May 2015 08:48:45 +0000
Fyodor Ustinov via Digitalmars-d <digitalmars-d puremagic.com> wrote:

 Simple code:
 
 http://pastebin.com/raw.php?i=7jVeMFXQ
 
 This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based
 on DMD v2.066.1 and LLVM 3.5.0.
 
 $ ./z
 TUQLUE
 42
 11
 
 Compiled by DMD v2.067.1 the program crashes:
 $ ./aa
 TUQLUE
 Segmentation fault
 
 What I'm doing wrong?
I think it is releted with this chage: http://dlang.org/changelog.html#heap-struct-destructors So your code has been probably wrong before, but accidentally works
May 04 2015
prev sibling next sibling parent reply "anonymous" <anonymous example.com> writes:
On Monday, 4 May 2015 at 08:48:47 UTC, Fyodor Ustinov wrote:
 Simple code:

 http://pastebin.com/raw.php?i=7jVeMFXQ

 This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based
 on DMD v2.066.1 and LLVM 3.5.0.

 $ ./z
 TUQLUE
 42
 11

 Compiled by DMD v2.067.1 the program crashes:
 $ ./aa
 TUQLUE
 Segmentation fault

 What I'm doing wrong?
Reduced it a little: ---- module z; import std.stdio; import std.concurrency; import core.thread; struct Variant { void function() fptr = &handler; static void handler() {} ~this() { fptr(); } } void _get(Tid id) { id.send(Variant()); } void supervisor() { receive(&_get); } void main() { Tid supervisorTid = spawn(&supervisor); supervisorTid.send(thisTid); writeln("TUQLUE"); receive( (Variant a) {} ); writeln("42"); thread_joinAll(); } ----
May 04 2015
parent "Fyodor Ustinov" <ufm ufm.su> writes:
On Monday, 4 May 2015 at 12:19:27 UTC, anonymous wrote:
 On Monday, 4 May 2015 at 08:48:47 UTC, Fyodor Ustinov wrote:
 Simple code:

 http://pastebin.com/raw.php?i=7jVeMFXQ

 This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) 
 based
 on DMD v2.066.1 and LLVM 3.5.0.

 $ ./z
 TUQLUE
 42
 11

 Compiled by DMD v2.067.1 the program crashes:
 $ ./aa
 TUQLUE
 Segmentation fault

 What I'm doing wrong?
     ~this() {
         fptr();
     }
~this() { writeln(fptr); fptr(); } $ ./aa TUQLUE 464E70 464E70 464E70 464E70 464E70 464E70 464E70 464E70 464E70 464E70 464E70 6C2AD0 Segmentation fault OMG.
May 04 2015
prev sibling parent "anonymous" <anonymous example.com> writes:
On Monday, 4 May 2015 at 08:48:47 UTC, Fyodor Ustinov wrote:
 Simple code:

 http://pastebin.com/raw.php?i=7jVeMFXQ

 This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based
 on DMD v2.066.1 and LLVM 3.5.0.

 $ ./z
 TUQLUE
 42
 11

 Compiled by DMD v2.067.1 the program crashes:
 $ ./aa
 TUQLUE
 Segmentation fault

 What I'm doing wrong?
I investigated this further. std.variant is to blame. I filed an issue an made a pull request to fix it: https://issues.dlang.org/show_bug.cgi?id=14585 https://github.com/D-Programming-Language/phobos/pull/3284
May 15 2015