[dmd-beta] rdmd heisenbug

Vladimir Panteleev thecybershadow.lists at gmail.com
Fri Jul 15 09:39:36 PDT 2011


Reposting my message from two days ago. I've also filed  
http://d.puremagic.com/issues/show_bug.cgi?id=6308 since then.

On Sun, 10 Jul 2011 02:58:04 +0300, Walter Bright <walter at digitalmars.com>
wrote:

> We've got a real heisenbug going on with rdmd.
>
> Anything that causes the memory layout of rdmd to be different causes it  
> to start working. This includes running it under the debugger. This  
> includes adding any printfs, compiling rdmd with the debug build of dmd,  
> etc.
>
> I suspect the problem is use of uninitialized memory in druntime/phobos.
>
> Anyone have any ideas?

I did a bit of research on this a few days ago. Using a certain debugger
and the map file, I found that the crash occurred in the autogenerated
scope(exit) for getDependencies - the block of code that calls the File
destructor. I didn't look too closely, but it looked like a bad "this"
pointer is passed to the File dtor. I tried a full DMD/Phobos regression
test, but didn't really get anywhere.

Just now, I tried to write the following program to test an unrelated
problem I encountered earlier, regarding destruction of temporaries and
DMC libc's low file count.

import std.stdio;

void main()
{
	foreach (i; 0..100)
		foreach (line; File("test.d").byLine)
			{}
}

The program crashes. I have a feeling that it's the same problem as with
rdmd.

Hope this helps.

-- 
Best regards,
    Vladimir                            mailto:vladimir at thecybershadow.net


More information about the dmd-beta mailing list