On Tuesday, 5 November 2013 at 09:34:47 UTC, John Colvin wrote:
On Monday, 4 November 2013 at 22:09:45 UTC, jerro wrote:
void main() {
auto s = CFS(1.0);      // crash
//auto s = CFS(1, Y()); // crash
//auto s = CFS(1, Y([])); // works
writeln(s);
}

What do you mean by crash ?

It's segfaults. It doesn't happen if you change 1.0 literal to
some other value,
say 2.0. It's a truly bizarre bug.

Here's a slightly simplified case:

import std.stdio;

struct Y {
    int[] _data;
}

struct CFS {
    double x;
    Y growth;
}

void main() {
    auto s = CFS(2.0);
    writefln("%x", s.growth._data.length); // prints
3ff0000000000000
}

It doesn't happen with -O, or when compiled with LDC or GDC.

Can't reproduce on Git master x86_64 linux. Prints 0 no matter what flags are used.

Oh wait no, sorry. It does print 3ff0000000000000 if I use 1.0 instead of 2.0

Reply via email to