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: v850: left shift cannot be represented in type 'int'
Date: Thu, 26 Dec 2019 09:09:00 -0000	[thread overview]
Message-ID: <6c2ca6c25dbefd7192dac52e7fd156ae0f299f1f@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 6c2ca6c25dbefd7192dac52e7fd156ae0f299f1f ***

commit 6c2ca6c25dbefd7192dac52e7fd156ae0f299f1f
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Thu Dec 26 15:56:25 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Thu Dec 26 17:49:03 2019 +1030

    ubsan: v850: left shift cannot be represented in type 'int'
    
    Another 1 << 31 complaint.
    
            * v850-dis.c (disassemble): Avoid signed overflow.  Don't use
            long vars when unsigned int will do.

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index bdbb5f74b1..07f30e27d6 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-26  Alan Modra  <amodra@gmail.com>
+
+	* v850-dis.c (disassemble): Avoid signed overflow.  Don't use
+	long vars when unsigned int will do.
+
 2019-12-24  Alan Modra  <amodra@gmail.com>
 
 	* arm-dis.c (print_insn_arm): Don't shift by 32 on unsigned int var.
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c
index 45e6c65d83..df2c2a5d39 100644
--- a/opcodes/v850-dis.c
+++ b/opcodes/v850-dis.c
@@ -499,7 +499,7 @@ disassemble (bfd_vma memaddr,
 						     0,  0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24 };
 		    int *regs;
 		    int i;
-		    unsigned long int mask = 0;
+		    unsigned int mask = 0;
 		    int pc = 0;
 
 		    switch (operand->shift)
@@ -514,12 +514,12 @@ disassemble (bfd_vma memaddr,
 
 		    for (i = 0; i < 32; i++)
 		      {
-			if (value & (1 << i))
+			if (value & (1u << i))
 			  {
 			    switch (regs[ i ])
 			      {
 			      default:
-				mask |= (1 << regs[ i ]);
+				mask |= (1u << regs[ i ]);
 				break;
 			      case 0:
 				/* xgettext:c-format */
@@ -543,10 +543,10 @@ disassemble (bfd_vma memaddr,
 			    int shown_one = 0;
 
 			    for (bit = 0; bit < 32; bit++)
-			      if (mask & (1 << bit))
+			      if (mask & (1u << bit))
 				{
-				  unsigned long int first = bit;
-				  unsigned long int last;
+				  unsigned int first = bit;
+				  unsigned int last;
 
 				  if (shown_one)
 				    info->fprintf_func (info->stream, ", ");
@@ -556,7 +556,7 @@ disassemble (bfd_vma memaddr,
 				  info->fprintf_func (info->stream, "%s", get_v850_reg_name (first));
 
 				  for (bit++; bit < 32; bit++)
-				    if ((mask & (1 << bit)) == 0)
+				    if ((mask & (1u << bit)) == 0)
 				      break;
 
 				  last = bit;


             reply	other threads:[~2019-12-26  9:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26  9:09 gdb-buildbot [this message]
2019-12-26  9:22 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-12-26 10:05 ` Failures on Fedora-i686, " gdb-buildbot
2019-12-26 10:12 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-12-26 10:17 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-12-26 10:31 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-12-26 10:46 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-12-26 10:47 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-12-26 10:53 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-26 11:10 ` 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=6c2ca6c25dbefd7192dac52e7fd156ae0f299f1f@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).