This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug target/32418] ICE in global_alloc, at global.c:514



------- Comment #9 from rask at sygehus dot dk  2007-06-21 15:59 -------
I tried this on top of the patch in comment 3 of bug 32441:

Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c      (revision 125892)
+++ gcc/config/m32c/m32c.c      (working copy)
@@ -1143,7 +1143,7 @@ m32c_eh_return_stackadj_rtx (void)
     {
       rtx sa;

-      sa = gen_reg_rtx (Pmode);
+      sa = gen_rtx_REG (Pmode, R0_REGNO);
       cfun->machine->eh_stack_adjust = sa;
     }
   return cfun->machine->eh_stack_adjust;

The build then ends with a reload failure in libstdc++.

Spilling for insn 228.
reload failure for reload 0

Reloads for insn # 228
Reload 0: reload_in (HI) = (plus:HI (reg/f:HI 7 fb)
                                                    (const_int 0 [0x0]))
        A_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0)
        reload_in_reg: (plus:HI (reg/f:HI 7 fb)
                                                    (const_int 0 [0x0]))

The lreg dump shows some insn sequences which use up both registers in
A_REGS:

(jump_insn 237 235 238 5 (set (pc)
        (label_ref 236)) 163 {jump} (nil))

(barrier 238 237 227)

(code_label/s 227 238 230 6 56 "" [1 uses])

(note 230 227 228 6 [bb 6])

(insn 228 230 229 6 (set (reg:HI 84)
        (reg:HI 4 a0)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 4 a0)
        (nil)))

(insn 229 228 102 6 (set (reg:HI 83)
        (reg:HI 5 a1)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 5 a1)
        (nil)))

...
(jump_insn 243 241 244 13 (set (pc)
        (label_ref 242)) 163 {jump} (nil))

(barrier 244 243 223)

(code_label/s 223 244 226 14 55 "" [1 uses])

(note 226 223 224 14 [bb 14])

(insn 224 226 225 14 (set (reg:HI 84)
        (reg:HI 4 a0)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 4 a0)
        (nil)))

(insn 225 224 166 14 (set (reg:HI 83)
        (reg:HI 5 a1)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 5 a1)
        (nil)))

(note/s 166 225 168 14 "" 52)
...
(insn 203 197 231 15
/home/rask/build/gcc-m32c-unknown-elf/m32c-unknown-elf/libstdc++-v3/include/complex:527
(use (reg/i:HI 0 r0)) -1 (nil))

(code_label/s 231 203 234 16 57 "" [1 uses])

(note 234 231 232 16 [bb 16])

(insn 232 234 233 16 (set (reg:HI 84)
        (reg:HI 4 a0)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 4 a0)
        (nil)))

(insn 233 232 185 16 (set (reg:HI 83)
        (reg:HI 5 a1)) 171 {movhi_op} (expr_list:REG_DEAD (reg:HI 5 a1)
        (nil)))

(code_label/s 185 233 186 17 53 "" [3 uses])

(note 186 185 187 17 [bb 17])

The usage count is one too high for all the code labels shown above. In
other words, the code that is causing reload problems is dead code. The code
first appears in the "eh" pass and refers to a0 and a1 from the beginning.

int
m32c_eh_return_data_regno (int n)
{
  switch (n)
    {
    case 0:
      return A0_REGNO;
    case 1:
      return A1_REGNO;
    default:
      return INVALID_REGNUM;
    }
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32418


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