https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80861
Wilco <wilco at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-05-23 CC| |wilco at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Gergö Barany from comment #0) > Created attachment 41407 [details] > Input C file for triggering the bug > > Consider the attached code: > > $ cat tst.c > char fn1(float p1) { > return (char) p1; > } Confirmed. This is due to the extend patterns allowing memory, but they aren't marked as having a higher cost, so it decides the spill given register move cost is larger than memory move cost. A quick workaround would be to add ??m to the various extend patterns.