public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Michael Frysinger <vapier@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]
Date: Tue,  8 Nov 2022 07:56:52 +0000 (GMT)	[thread overview]
Message-ID: <20221108075652.1E4273858C2B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2756004fe78954754946b61d3f6338d8b72b8332

commit 2756004fe78954754946b61d3f6338d8b72b8332
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri Nov 4 07:38:20 2022 +0700

    sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]
    
    The intention of this code seems to be to indicate that this insn
    should not be used and produces undefined behavior, so instead of
    setting registers to bogus values, call Unpredictable.  This fixes
    build warnings due to 32-bit/64-bit type conversions, and outputs
    a log message for users at runtime instead of silent corruption.
    
    Bug: https://sourceware.org/PR29276

Diff:
---
 sim/mips/mips.igen | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen
index dfad4227615..0746a52d5ab 100644
--- a/sim/mips/mips.igen
+++ b/sim/mips/mips.igen
@@ -1450,7 +1450,7 @@
   else if ((fs & 0x1) == 0)
     GPR[rt] = SET64HI (FGR[fs+1]) | FGR[fs];
   else
-    GPR[rt] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0;
+    Unpredictable ();
   TRACE_ALU_RESULT (GPR[rt]);
 }
 
@@ -5782,7 +5782,7 @@
   else if ((FS & 0x1) == 0)
     v = SET64HI (FGR[FS+1]) | FGR[FS];
   else
-    v = SET64HI (0xDEADC0DE) | 0xBAD0BAD0;
+    Unpredictable ();
   PENDING_FILL (RT, v);
   TRACE_ALU_RESULT (v);
 }

                 reply	other threads:[~2022-11-08  7:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221108075652.1E4273858C2B@sourceware.org \
    --to=vapier@sourceware.org \
    --cc=gdb-cvs@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).