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

--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
This turned out to be a red herring, but I believe the following patch
eliminates some undefined behaviour in the iq2000 port, changing the test for
SMALL_INT to match the MIPS backend's definition [avoiding possible signed
integer overflow]:

diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index b2a960a2909f..82f72db370f8 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -629,7 +629,7 @@ enum delay_type
 #define GR_REG_CLASS_P(CLASS)                                          \
   ((CLASS) == GR_REGS)

-#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) <
0x10000)
+#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X)) + 0x8000 <
0x10000)
 #define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (INTVAL (X)) <
0x10000)

 /* Certain machines have the property that some registers cannot be

Or perhaps use UINTVAL?  Let me know if you agree.

Reply via email to