Tricky DMD bug, but I have no idea how to report

H. S. Teoh hsteoh at
Fri Feb 8 00:30:28 UTC 2019

On Thu, Feb 07, 2019 at 10:16:19PM +0000, JN via Digitalmars-d-learn wrote:
> Anyway, I managed to reduce the source code greatly manually:
> unfortunately I can't get rid of the dlib dependency. When built with
> debug, test outputs [0: Object], with release it outputs [0: null].
> commenting this line out:
> f.rotation = Quaternionf.fromEulerAngles(Vector3f(0.0f, 0.0f, 0.0f));
> or changing it to:
> f.rotation = Quaternionf.identity();
> is enough to make release output [0: Object] as well. I guess dlib is
> doing something dodgy with memory layout, but I can't see anything
> suspicious :(

Hmm. I can't seem to reproduce this in my environment (Linux/x86_64).
Tried it with various combinations of `dub -b release|debug|etc.`,
manually compiling with `dmd -I~/.dub/packages/dlib-0.15.0/dlib` with
various combinations of -release, -debug, etc..

I wonder if you somehow have an ABI mismatch caused by stale cached
objects in dub?  Perhaps try `dub --force` to force a rebuild of
everything?  Or, if you're daring, delete the entire dub cache and
rebuild, just to be sure there are no stray stale files lying around

Barring that, one way to narrow this down further is to copy the
relevant dlib sources into your own source tree, remove the dub
dependency, and then reduce the dlib sources as well.  I did a quick and
crude test, and discovered that you only need the following files:


Replace dlib/core/package.d with an empty file, and edit
dlib/math/package.d to import only dlib.math.quaternion and

Since you're only using a very small number of functions, you can
probably quickly eliminate most of the above files too. Just edit the
files directly (since they're your own copy) and delete everything that
isn't directly needed by your code.  Of course, at the same time check
also that deleting doesn't change the bug behaviour. If it does, then
whatever you just deleted may possibly be (part of) the cause of the

Sorry I can't help you with reproducing the problem, as the bug doesn't
seem to show up in my environment.  (I suspect it's still there, just
that subtle differences in my environment may be masking it somehow.)


Political correctness: socially-sanctioned hypocrisy.

More information about the Digitalmars-d-learn mailing list