From patchwork Tue Aug 17 07:27:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: : Fix PR45296, register long double ICE at -O2, -Os, -O3 Date: Mon, 16 Aug 2010 21:27:59 -0000 From: Uros Bizjak X-Patchwork-Id: 61867 Message-Id: To: gcc-patches@gcc.gnu.org Hello! We should reject stack registers as global registers, otherwise stack compensation code ICEs. 2010-08-17 Uros Bizjak PR target/45296 * reginfo.c (globalize_reg): Reject stack registers. testsuite/ChangeLog: 2010-08-17 Uros Bizjak PR target/45296 * gcc.target/i386/pr45296.c: New test. Tested on x86_64-pc-linux-gnu {,-m32}. OK for mainline and release branches? Uros. Index: testsuite/gcc.target/i386/pr45296.c =================================================================== --- testsuite/gcc.target/i386/pr45296.c (revision 0) +++ testsuite/gcc.target/i386/pr45296.c (revision 0) @@ -0,0 +1 @@ +register long double F80 __asm__("st"); /* { dg-error "stack register" } */ Index: reginfo.c =================================================================== --- reginfo.c (revision 163291) +++ reginfo.c (working copy) @@ -798,6 +798,14 @@ fix_register (const char *name, int fixe void globalize_reg (int i) { +#ifdef STACK_REGS + if (IN_RANGE (i, FIRST_STACK_REG, LAST_STACK_REG)) + { + error ("stack register used for global register variable"); + return; + } +#endif + if (fixed_regs[i] == 0 && no_global_reg_vars) error ("global register variable follows a function definition");