On Tue, Mar 14, 2017 at 03:26:44PM +0000, Stefan Koch via Digitalmars-d wrote: [...] > Bad news. > Array expansion via assignment to length regressed. > Fixing this is surprisingly time intensive. > .... I am just not seeing where it's going wrong. > > It seems to use completely bogus offsets ... causing it to read from > uninitialized memory.
Sounds like there's a pointer bug / stack overflow / buffer overflow somewhere. Just my gut feeling from having faced similar bugs in my career. Unfortunately, these kinds of bugs are usually very difficult to trace, because the root cause can be very far away from where the symptoms show up, and can come from completely unrelated code. One way that sometimes works (but not always) is to try to shuffle the stack by moving functions / local variables around to see if the symptoms change. That may yield some clues as to the nature of the problem. But that's just a shot in the dark... generally these kinds of bugs are very hard to trace. Or maybe carefully step through the code starting from the length assignment in a debugger and see if any of the variables seem to have strange values. Sometimes the code immediately following is fine (inserting printf's of the buffer may indicate correct values) but it's something that happens afterwards that screws it up. Or, possibly, the state is already messed up before the length assignment... in which case it would be far more difficult to trace. :-( T -- If lightning were to ever strike an orchestra, it'd always hit the conductor first.
