Created attachment 298275 [details] emerge --info gcc-4.6.1-r1 and gcc-4.6.2 both with --march=bdver1 creates media-libs/jpeg that corrupts input jpegs and can't save jpegs. Tested with gimp, firefox, konqueror, and media-gfx/imagemagick(convert input.png output.jpg). tested with jpeg 7 and 8. # convert input.png output.jpg convert: DCT coefficient out of range `Untitled.jpg' @ error/jpeg.c/JPEGErrorHandler/297.
this appears to be related to <https://bugs.gentoo.org/show_bug.cgi?id=399251>. If I set my CFLAGS="-O3 -march=bdver1 -mno-sse4.1 -mno-avx" I get no problem.
This appears to be corrected in gcc 4.7.0. I used a modified ebuild from the toolchain overlay for gcc.
You can try 4.6.4, but if that doesn't work then use 4.7. The 4.6 branch is closed upstream so without a specific patch we can't do much about it.