[Bug target/81485] [SH] ICE: in sh_find_set_of_reg, at config/sh/sh-protos.h:232

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 10 15:18:00 GMT 2017


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

--- Comment #6 from Oleg Endo <olegendo at gcc dot gnu.org> ---
And in fact, there has been a change to the function sh_find_set_of_reg.  I'd
have to dig through the archives etc to find out what was going on there. 
Meanwhile, it seems that the small backport patch below fixes the issue,
although I have not done any proper tests.

Index: gcc/config/sh/sh-protos.h
===================================================================
--- gcc/config/sh/sh-protos.h   (revision 240471)
+++ gcc/config/sh/sh-protos.h   (working copy)
@@ -228,8 +228,12 @@
        }
     }

-  if (result.set_src != NULL)
-    gcc_assert (result.insn != NULL && result.set_rtx != NULL);
+  /* If the searched reg is found inside a (mem (post_inc:SI (reg))), set_of
+     will return NULL and set_rtx will be NULL.
+     In this case report a 'not found'.  result.insn will always be non-null
+     at this point, so no need to check it.  */
+  if (result.set_src != NULL && result.set_rtx == NULL)
+    result.set_src = NULL;

   return result;
 }


More information about the Gcc-bugs mailing list