[PATCH] Remove undefined behaviour from hppa backend

Jeff Law law@redhat.com
Tue Sep 22 19:12:00 GMT 2015



Not unlike what we've seen in other ports.  The PA backend left-shifts a 
negative number invoking undefined behaviour.

This patch avoids the warning for undefined behaviour and presumably 
would allow the PA port to bootstrap again.

Tested with the various PA crosses listed in config-list.mk.  Installed 
on the trunk.

Jeff
-------------- next part --------------
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cf31527..53da589 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-22  Jeff Law  <law@redhat.com>
+
+	* config/pa/pa.h (MIN_LEGIT_64BIT_CONST_INT: Avoid undefined
+	behavior.
+
 2015-09-22  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* doc/invoke.texi  (-Wmultiple-inheritance, -Wvirtual-inheritance,
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 9fd036f..511ea81 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -814,7 +814,8 @@ extern int may_call_alloca;
    this range are forced to the constant pool prior to reload.  */
 
 #define MAX_LEGIT_64BIT_CONST_INT ((HOST_WIDE_INT) 32 << 31)
-#define MIN_LEGIT_64BIT_CONST_INT ((HOST_WIDE_INT) -32 << 31)
+#define MIN_LEGIT_64BIT_CONST_INT \
+  ((HOST_WIDE_INT)((unsigned HOST_WIDE_INT) -32 << 31))
 #define LEGITIMATE_64BIT_CONST_INT_P(X) \
   ((X) >= MIN_LEGIT_64BIT_CONST_INT && (X) < MAX_LEGIT_64BIT_CONST_INT)
 


More information about the Gcc-patches mailing list