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/67061] sh64-elf: internal compiler error: in sh_find_set_of_reg, at config/sh/sh-protos.h:235


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67061

--- Comment #2 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #1)
> Hm ..
> 
>   for (result.insn = stepfunc (insn); result.insn != NULL_RTX;
>        previnsn = result.insn, result.insn = stepfunc (result.insn))
> 
> that "previnsn = ... " in sh_find_set_of_reg looks broken.  I wonder how/why
> it never showed up for normal SH targets (normal = non-SH64).  I'll have a
> look at this.

SHCOMPACT target uses different ABI for the function calls.
It looks that that makes sh_find_set_of_reg unhappy.
k_cos.c case is here:

...
(call_insn/i 29 28 30 3 (parallel [
            (set (reg:SI 2 r2)
                (call (mem:SI (reg/f:SI 509) [0  S4 A32])
                    (const_int 0 [0])))
            (const_int 1610612736 [0x60000000])
            (use (reg:SI 0 r0))
            (use (reg:SI 1 r1))
            (use (reg:SI 154 fpscr0))
            (clobber (reg:SI 146 pr))
        ]) ...k_cos.c:78 323 {call_value_compact}
     (expr_list:REG_DEAD (reg:SI 154 fpscr0)
        (expr_list:REG_DEAD (reg:SI 1 r1)
            (expr_list:REG_DEAD (reg:SI 0 r0)
                (expr_list:REG_CALL_DECL (symbol_ref:SI ("__fixdfsi") [flags
0x41])
                    (expr_list:REG_EH_REGION (const_int -2147483648
[0xffffffff80000000])
                        (nil))))))
    (expr_list (use (reg:SI 2 r2))
        (expr_list (use (mem/c:DF (reg/f:SI 508) [1  S8 A64]))
            (nil))))
(note 30 29 31 3 NOTE_INSN_DELETED)
(insn 31 30 32 3 (set (reg:SI 147 t)
        (eq:SI (reg:SI 2 r2)
            (const_int 0 [0]))) ...k_cos.c:78 12 {cmpeqsi_t}
     (expr_list:REG_DEAD (reg:SI 2 r2)
        (nil)))
...

and the problem happens at the call of sh_find_set_of_reg

Breakpoint 2, sh_find_extending_set_of_reg (reg=0xb7e95e24, 
    curr_insn=curr_insn@entry=0xb7e99480)
    at /exp/ldroot/dodes/xsh64-elf-combined/combined/gcc/config/sh/sh.c:13925
13925           sh_find_set_of_reg (reg, curr_insn, prev_nonnote_insn_bb,
true);

where reg is r2 and curr_insn is the insn 31.  sh_find_set_of_reg is
stepping backward from the insn 31 but the call_insn 29 is missed.

Does the patch below work?

Oleg, it's the same one we've discussed, I think.  Thought?

diff --git a/config/sh/sh-protos.h b/config/sh/sh-protos.h
index 5a552e2..3b725ba 100644
--- a/config/sh/sh-protos.h
+++ b/config/sh/sh-protos.h
@@ -198,7 +198,8 @@ sh_find_set_of_reg (rtx reg, rtx_insn* insn, F stepfunc,
     {
       if (BARRIER_P (result.insn))
        break;
-      if (!NONJUMP_INSN_P (result.insn))
+      if (!NONJUMP_INSN_P (result.insn)
+         && !(REGNO (reg) < FIRST_PSEUDO_REGISTER && CALL_P (result.insn)))
        continue;
       if (reg_set_p (reg, result.insn))
        {


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