Common practices such as turning off ccache and pipe, setting number of jobs to 1 don't help. Googling of the errors didn't give any clues.
The complete log: http://ompldr.org/iaHZlcA
The output of emerge --info =gcc-4.7.2: http://pastebin.com/Pa1S1Pf3
Any help is appreciated.

Last edited by elftr on Wed Mar 27, 2013 1:06 pm; edited 1 time in total

/gcc-4.7.2-r1/work/gcc-4.7.2/gcc/c-lang.c -o c-lang.o
In file included from ./tm.h:19:0,
from /var/tmp/portage/sys-devel/gcc-4.7.2-r1/work/gcc-4.7.2/gcc/c-lang.c:26:
./options.h:3744:2: error: #error too many masks for ix86_isa_flags

Very often all errors that follow result from the first one. I think it has something to do with 32/64 bit arch, but maybe there will be someone in the know to give you more hints. In the meantime, could you upload and paste link to /var/tmp/portage/sys-devel/gcc-4.7.2-r1/temp/build.log?

Oops, sorry. Here it is: http://ompldr.org/vaHZsZg
I tried to remove all USE flags except cxx but result was exactly the same. Can you post your `emerge --info gcc` please? Maybe I use wrong CFLAGS or something.

Looks similar to my config. Just to clarify I reemerged @system (maybe some tool needed to build gcc was broken?) but error still occurs.
The error looks like gcc is configured improperly. What can affect configuration?