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: ia64: left shift of negative value
Date: Wed, 11 Dec 2019 01:34:00 -0000	[thread overview]
Message-ID: <8ff23dba80b80a9f47d75dd43812e041f6674763@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 8ff23dba80b80a9f47d75dd43812e041f6674763 ***

commit 8ff23dba80b80a9f47d75dd43812e041f6674763
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Tue Dec 10 17:57:14 2019 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Wed Dec 11 11:33:36 2019 +1030

    ubsan: ia64: left shift of negative value
    
    Here, since val is signed:
       *valuep = (val << scale);
    
            * cpu-ia64-opc.c (ext_imms_scaled): Avoid undefined left shift
            of negative values by using unsigned vars.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 50c878b29d..17ad44160a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
+	* cpu-ia64-opc.c (ext_imms_scaled): Avoid undefined left shift
+	of negative values by using unsigned vars.
+
 2019-12-07  Alan Modra  <amodra@gmail.com>
 
 	PR 25236
diff --git a/bfd/cpu-ia64-opc.c b/bfd/cpu-ia64-opc.c
index 84ee0e2e4a..8df90befe3 100644
--- a/bfd/cpu-ia64-opc.c
+++ b/bfd/cpu-ia64-opc.c
@@ -186,7 +186,7 @@ ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
 		 ia64_insn *valuep, int scale)
 {
   int i, bits = 0, total = 0;
-  BFD_HOST_64_BIT val = 0, sign;
+  BFD_HOST_U_64_BIT val = 0, sign;
 
   for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
     {
@@ -196,10 +196,10 @@ ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
       total += bits;
     }
   /* sign extend: */
-  sign = (BFD_HOST_64_BIT) 1 << (total - 1);
+  sign = (BFD_HOST_U_64_BIT) 1 << (total - 1);
   val = (val ^ sign) - sign;
 
-  *valuep = (val << scale);
+  *valuep = val << scale;
   return 0;
 }
 


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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  1:34 gdb-buildbot [this message]
2019-12-11  1:30 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-12-11  2:06 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-12-11  3:34 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-12-11  3:40 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-12-11  3:48 ` Failures on Fedora-i686, " gdb-buildbot
2019-12-11  3:54 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-12-11  4:16 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-12-11  4:34 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-11  4:38 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-12-11  4:44 ` 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=8ff23dba80b80a9f47d75dd43812e041f6674763@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).