public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix undefined behaviour in cris port
@ 2015-09-26  9:05 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2015-09-26  9:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]


Yet another left shift of a negative number.  Fixed in the obvious way. 
  Tested by completing the cris-* builds in config-list.mk using a trunk 
compiler.

Installed on the trunk.

Jeff

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1880 bytes --]

commit 6759b0576ae1f474749cc901e0e3d5679f546251
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sat Sep 26 07:33:05 2015 +0000

    [PATCH] Fix undefined behaviour in cris port
    	* config/cris/cris.md (asrandb): Fix left shift undefined
    	behaviour.
    	(asrandw): Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228163 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 910fd4f..98c1bd9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-26  Jeff Law  <law@redhat.com>
+
+	* config/cris/cris.md (asrandb): Fix left shift undefined
+	behaviour.
+	(asrandw): Likewise.
+
 2015-09-25  Vladimir Makarov  <vmakarov@redhat.com>
 
 	PR target/61578
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 3c2409b..b90d6b1 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -4634,7 +4634,8 @@
    && INTVAL (operands[1]) > 23
    /* Check that the and-operation enables us to use logical-shift.  */
    && (INTVAL (operands[2])
-	  & ((HOST_WIDE_INT) -1 << (32 - INTVAL (operands[1])))) == 0"
+       & ((HOST_WIDE_INT) (HOST_WIDE_INT_M1U
+			   << (32 - INTVAL (operands[1]))))) == 0"
   [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
    (set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
   ;; FIXME: CC0 is valid except for the M bit.
@@ -4655,7 +4656,8 @@
    && INTVAL (operands[1]) > 15
    /* Check that the and-operation enables us to use logical-shift.  */
    && (INTVAL (operands[2])
-       & ((HOST_WIDE_INT) -1 << (32 - INTVAL (operands[1])))) == 0"
+       & ((HOST_WIDE_INT) (HOST_WIDE_INT_M1U
+			   << (32 - INTVAL (operands[1]))))) == 0"
   [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
    (set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
   ;; FIXME: CC0 is valid except for the M bit.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-26  7:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26  9:05 [PATCH] Fix undefined behaviour in cris port Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).