public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] ubsan: s12z: left shift cannot be represented in type 'int'
Date: Wed, 11 Dec 2019 14:22:00 -0000	[thread overview]
Message-ID: <205c426a9bb387204a21165e2275e31c32248035@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 205c426a9bb387204a21165e2275e31c32248035 ***

commit 205c426a9bb387204a21165e2275e31c32248035
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Wed Dec 11 08:37:53 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Wed Dec 11 11:40:51 2019 +1030

    ubsan: s12z: left shift cannot be represented in type 'int'
    
            * s12z-opc.c (z_decode_signed_value): Avoid signed overflow.

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index ddf8cd0072..a8e1d30a9d 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
+	* s12z-opc.c (z_decode_signed_value): Avoid signed overflow.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
 	* ns32k-dis.c (bit_extract): Use unsigned arithmetic.
diff --git a/opcodes/s12z-opc.c b/opcodes/s12z-opc.c
index 3e0c0e0582..044c72a21c 100644
--- a/opcodes/s12z-opc.c
+++ b/opcodes/s12z-opc.c
@@ -410,9 +410,7 @@ z_decode_signed_value (struct mem_read_abstraction_base *mra, int offset,
   int i;
   uint32_t value = 0;
   for (i = 0; i < size; ++i)
-    {
-      value |= buffer[i] << (8 * (size - i - 1));
-    }
+    value = (value << 8) | buffer[i];
 
   if (buffer[0] & 0x80)
     {


             reply	other threads:[~2019-12-11 14:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 14:22 gdb-buildbot [this message]
2019-12-11 14:24 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-12-11 14:54 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-11 15:05 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-12-12  1:49 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-12-12  1:59 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-12-12  2:26 ` Failures on Fedora-i686, " gdb-buildbot
2019-12-12  2:29 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-12-12  2:29 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-12-12  2:48 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-12  2:52 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-12-12  3:24 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=205c426a9bb387204a21165e2275e31c32248035@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).