http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55718
Andreas Krebbel <krebbel at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2012-12-18 AssignedTo|unassigned at gcc dot |krebbel at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #3 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-12-18 11:30:06 UTC --- Created attachment 28993 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28993 Experimental fix Starting with http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00088.html UNSPEC GOTENTs are accepted as legitimate address what leads to this error. For the strlen implementation we subtract the result from the source pointer. In the testcase the subtraction is done in a mode smaller than pointer size (SImode). The source pointer is the address of a global symbol in the GOT. Resolving the subreg on the address reload generates: (const:DI (plus:DI (unspec:DI [ (symbol_ref:DI ("temp") [flags 0x440] <var_decl 0x200060095f0 temp>) ] UNSPEC_GOTENT) (const_int 4 [0x4]))) Instead of just letting it pass legitmize_pic_address tries to generate code for the add what needs an additional register. The attached patch fixes this.