I'm also using Gentoo and GCC 4.2.0, and the same thing happened to me a few weeks ago. What I can't understand is why the "force compilation if can't read timestamp but file exists" code isn't working for others.
When I separated that code (depslib) to find the reason why it wasn't working, it worked fine. I tried with Code::Blocks once again, and it worked fine too.
Try uninstalling Code::Blocks, cleaning (delete object files and pch) and building again.