This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

reinit regs upon global reg variable (IRA regression)

QEMU for x86 declares a global variable with register asm("%ebp").  GCC
trunk will miscompile it, using %ebp for normal register allocation
(rather than frame pointer; it compiles with -O2 -fomit-frame-pointer),
which ends up clobbering the variable.

There's a testcase at

compute_all_subb is one of the functions that displays the problem.

Turns out the new register allocation is using outdated information:
available (rather than fixed) register information in each register
class is computed before compilation starts, but it wasn't updated when
new registers became global, and IRA needs this information to be

This patch fixes it.

Bootstrapped and regression tested on i686-linux-gnu and
x86_64-linux-gnu.  Ok to install?

Jakub, would you please check this in if it's approved; I'm leaving on a
trip tomorrow morning, and I don't expect to have much
Internet-connected computer time before Monday, at the earliest.

for  gcc/ChangeLog
from  Alexandre Oliva  <>

	* reginfo.c (globalize_reg): Recompute derived reg sets.

Index: gcc/reginfo.c
--- gcc/reginfo.c.orig	2009-03-01 02:16:18.000000000 -0300
+++ gcc/reginfo.c	2009-03-17 00:34:49.000000000 -0300
@@ -875,6 +875,8 @@ globalize_reg (int i)
   SET_HARD_REG_BIT (fixed_reg_set, i);
   SET_HARD_REG_BIT (call_used_reg_set, i);
   SET_HARD_REG_BIT (call_fixed_reg_set, i);
+  reinit_regs ();

Alexandre Oliva 
You must be the change you wish to see in the world. -- Gandhi
Be Free! --   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]