The ebuild must set CC to $(tc-getCC)
Created attachment 98837 [details, diff] cgilib-0.5.patch
Fixed in CVS, thanks for reporting :) BTW your patch was inversed ;)