As reported here http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21804 gcc 3.4.* is generatig bad code. I tested it with with gcc --version gcc (GCC) 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9) and it is still the same. -O1 seems to work, -Os, -O2 and -O3 are evil. Therefore please mask 3.4 (or strip the CFLAGS). There is no other stable gcc in portage and 3.3 + 4.1 are masked.
sorry, but not a chance that 3.4 will be masked
Does this affect some package in the tree? If not, I'm not going to try finding the commit which fixed this. If you can show me something in the tree that is affected by this bug, then please reopen it. if someone on toolchain disagrees, please let me know, but I don't think this is going to be worth it :)
I noticed this by chance and though it is serious. I "greped" the kernel and libc and did not find anything. Sorry for the inconvenience.