http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34130 cause some bugs in some software. Suggested fix: http://gcc.gnu.org/viewcvs/branches/gcc-4_2-branch/gcc/fold-const.c?r1=130352&r2=130351&pathrev=130352
Created attachment 139798 [details, diff] pr34130.patch
From gcc's bugzilla: 4.1.3 and 4.2.2 are known to fail. I tested with 4.1.2 on HPPA and it (unsurprisingly) fails. This is the current stable gcc on all gentoo archs. I tested with 4.2.4 and 4.3.2 on HPPA and they give correct results.
this is fixed in gcc-4.3.2