summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-25 09:27:54 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-25 09:27:54 +0000
commit0274601cb3f228abb6b7fa1d895606250e3f5868 (patch)
tree0a1161c992db7af1af2107a57cc510c6a2082954 /gcc
parent38f165ba0b555850e2f2d7976dc88da8fdb757a4 (diff)
downloadgcc-0274601cb3f228abb6b7fa1d895606250e3f5868.tar.gz
* cselib.c (cselib_hash_rtx): Perform addition in unsigned
type to avoid signed integer overflow. * explow.c (plus_constant): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cselib.c2
-rw-r--r--gcc/explow.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95e46dcf7f6..8ba19f5617e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-25 Jakub Jelinek <jakub@redhat.com>
+
+ * cselib.c (cselib_hash_rtx): Perform addition in unsigned
+ type to avoid signed integer overflow.
+ * explow.c (plus_constant): Likewise.
+
2014-03-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
* doc/generic.texi: Correct typos.
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 26bcbe07769..7918b2be869 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -1137,7 +1137,7 @@ cselib_hash_rtx (rtx x, int create, enum machine_mode memmode)
return hash ? hash : (unsigned int) ENTRY_VALUE;
case CONST_INT:
- hash += ((unsigned) CONST_INT << 7) + INTVAL (x);
+ hash += ((unsigned) CONST_INT << 7) + UINTVAL (x);
return hash ? hash : (unsigned int) CONST_INT;
case CONST_DOUBLE:
diff --git a/gcc/explow.c b/gcc/explow.c
index f4df9df4238..4e2f70448fb 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -110,7 +110,7 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c)
return immed_double_int_const (v, mode);
}
- return gen_int_mode (INTVAL (x) + c, mode);
+ return gen_int_mode (UINTVAL (x) + c, mode);
case CONST_DOUBLE:
{