In make.conf there would be specified two set's of C/CXXFLAGS. in example CFLAGS_DEFAULT/
CXXFLAGS_DEFAULT and CFLAGS_SAFE/CXXFLAGS_SAFE. The _DEFAULT would be used for normal packages nad _SAFE would be used in packages like glibc, xorg-x11 and so on instead of filtering unsafe flags from CFLAGS/CXXFLAGS.
There could be file like package.badflags in profile and/or /etc/portage which would look like this:
<package>/<category>-<version> CFLAGS="-foo" CXXFLAGS="-bar"
and the the bad flags would be taken from the package.badflags and turned off for a specific package.
Aditionaly there could be a package.goodflags that would override the settings in package.badflags
Steps to Reproduce:
*** This bug has been marked as a duplicate of 44796 ***