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: m68k: left shift cannot be represented in type 'int'
Date: Wed, 11 Dec 2019 11:44:00 -0000	[thread overview]
Message-ID: <334175b693a1cbab8850f5faa6937e7c6ca3db7d@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 334175b693a1cbab8850f5faa6937e7c6ca3db7d ***

commit 334175b693a1cbab8850f5faa6937e7c6ca3db7d
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Wed Dec 11 08:23:33 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Wed Dec 11 11:39:42 2019 +1030

    ubsan: m68k: left shift cannot be represented in type 'int'
    
            * m68k-dis.c (COERCE32): Cast value first.
            (NEXTLONG, NEXTULONG): Avoid signed overflow.

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8d48b5a8cd..ffe57a4514 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
+	* m68k-dis.c (COERCE32): Cast value first.
+	(NEXTLONG, NEXTULONG): Avoid signed overflow.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
 	* h8300-dis.c (extract_immediate): Avoid signed overflow.
diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c
index 7584541402..6e913d7abd 100644
--- a/opcodes/m68k-dis.c
+++ b/opcodes/m68k-dis.c
@@ -96,7 +96,7 @@ enum print_insn_arg_error
   while (0)
 
 /* Get a 4 byte signed integer.  */
-#define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000)
+#define COERCE32(x) (((bfd_vma) (x) ^ 0x80000000) - 0x80000000)
 
 #define NEXTLONG(p, val, ret_val)					\
   do									\
@@ -104,7 +104,8 @@ enum print_insn_arg_error
       p += 4;								\
       if (!FETCH_DATA (info, p))					\
 	return ret_val;							\
-      val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
+      val = COERCE32 (((((((unsigned) p[-4] << 8) + p[-3]) << 8)	\
+			+ p[-2]) << 8) + p[-1]);			\
     }									\
   while (0)
 
@@ -115,7 +116,8 @@ enum print_insn_arg_error
       p += 4;								\
       if (!FETCH_DATA (info, p))					\
 	return PRINT_INSN_ARG_MEMORY_ERROR;				\
-      val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
+      val = (((((((unsigned) p[-4] << 8) + p[-3]) << 8)			\
+	       + p[-2]) << 8) + p[-1]);					\
     }									\
   while (0)
 


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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 11:44 gdb-buildbot [this message]
2019-12-11 11:50 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-12-11 20:09 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-12-11 20:10 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-12-11 20:26 ` Failures on Fedora-i686, " gdb-buildbot
2019-12-11 20:52 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-12-11 20:52 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-12-11 21:15 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-11 21:20 ` 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=334175b693a1cbab8850f5faa6937e7c6ca3db7d@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).