diff mbox

Remove undefined behaviour from hppa backend

Message ID 5601A060.2010308@redhat.com
State New
Headers show

Commit Message

Jeff Law Sept. 22, 2015, 6:39 p.m. UTC
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
diff mbox

Patch

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)