Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 04, 2015 What wrong? | ||||
---|---|---|---|---|
| ||||
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 Re: What wrong? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fyodor Ustinov | 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 Re: What wrong? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fyodor Ustinov | 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 Re: What wrong? | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | 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 15, 2015 Re: What wrong? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fyodor Ustinov | 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 |
Copyright © 1999-2021 by the D Language Foundation