fix Issue 10398 - Dmd bugs detected by memcheck when compile druntime+ph...

...obos

Fixes items 3 and 4 of http://d.puremagic.com/issues/show_bug.cgi?id=10398

See also pull #2486