public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]
@ 2022-11-04  0:41 Mike Frysinger
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2022-11-04  0:41 UTC (permalink / raw)
  To: gdb-patches

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
---
 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 dfad42276155..0746a52d5ab1 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);
 }
-- 
2.38.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-04  0:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  0:41 [PATCH] sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276] Mike Frysinger

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).