O_o
Okay. Wow.
I'm not reading through all of that code, and I'm sure this has been said, but it could stand repeating: start with a clean source file adding only a little back, compiling each addition, until you find where your bug lives.
Or, you know, post the example as you've been asked.
Soma