A very strange bug. DMD 2.058 64-bit Linux

Timon Gehr timon.gehr at gmx.ch
Sun Feb 26 12:23:36 PST 2012


On 02/26/2012 09:06 PM, Caligo wrote:
> Once you have those two files, compile with this:
>
> dmd -unittest t1.d bug.d
>
> and then run t1:
>
> ./t1
>
> The output you get should look like this:
>
> ...
> [0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0]
>

I get:

...
[0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0]

>
> Obviously the output is wrong.  'm9' for some reason is getting
> overwritten.  In my project this caused big problems because there are
> other m# with different values, and their values would literally get
> copied to m9.  Calling inverse() on m9 then would fail because the
> other matrices are not invertible.  Placing a writeln() in inverse()
> helped me realize that what was being passed to inverse() was being
> modified somewhere.  I'm still now sure how m9 is being modified.
>
> Another point, compiling with this:
>
> dmd -unittest bug.d t1.d
>
> and then running bug:
>
> ./bug
>
> doesn't trigger the bug.
>

I get:

...
[4, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0, 1]

>
> Could someone else please confirm this behavior?

I have used DMD 2.058 64-bit linux.


More information about the Digitalmars-d-learn mailing list