[Bug target/78633] [7 Regression] [SH] libgcc/fp-bit.c:944:1: error: invalid rtl sharing found in the insn

kkojima at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 7 00:52:00 GMT 2016


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

--- Comment #11 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Created attachment 40271
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40271&action=edit
reduce testcase

With -O1, sh4-linux compiler makes insns

(insn 67 150 165 5 (set (reg:SI 239)
        (and:SI (subreg:SI (reg/v:DI 163 [ high ]) 0)
            (const_int 1 [0x1]))) "test.c":34 88 {*andsi_compact}
     (nil))
(insn 165 67 74 5 (set (reg:SI 147 t)
        (eq:SI (and:SI (subreg:SI (reg/v:DI 163 [ high ]) 0)
                (const_int 1 [0x1]))
            (const_int 0 [0]))) "test.c":34 -1
     (nil))

and two (subreg:SI (reg/v:DI 163 [ high ]) 0) are shared.

emit-rtl.c:verify_rtl_sharing calls verify_insn_sharing for these
insns and verify_insn_sharing marks rtxes with verify_rtx_sharing.
SUBREG rtx is always marked as used with verify_rtx_sharing.  Then
the second subreg is reported as erroneous because it's already
marked as used.  I think that this is a false positive.  It seems
to me that SUBREG should be handled specially.

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 4650540..4fa4773 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2714,6 +2714,9 @@ verify_rtx_sharing (rtx orig, rtx insn)
     case SCRATCH:
       /* SCRATCH must be shared because they represent distinct values.  */
       return;
+    case SUBREG:
+      verify_rtx_sharing (SUBREG_REG (x), insn);
+      return;
     case CLOBBER:
       /* Share clobbers of hard registers (like cc0), but do not share pseudo
reg
          clobbers or clobbers of hard registers that originated as pseudos.

I could be totally wrong about that, though.


More information about the Gcc-bugs mailing list