changeset 8565c34ec32e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=8565c34ec32e
description:
        x86: fix issue with casting in Cvtf2i

        UBSAN flags this operation because it detects that arg is being cast 
directly
        to an unsigned type, argBits. this patch fixes this by first casting the
        value to a signed int type, then reintrepreting the raw bits of the 
signed
        int into argBits.

diffstat:

 src/arch/x86/isa/microops/mediaop.isa |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (17 lines):

diff -r 9e5050028323 -r 8565c34ec32e src/arch/x86/isa/microops/mediaop.isa
--- a/src/arch/x86/isa/microops/mediaop.isa     Sat Nov 19 12:39:04 2016 -0500
+++ b/src/arch/x86/isa/microops/mediaop.isa     Mon Nov 21 15:35:56 2016 -0500
@@ -1220,9 +1220,11 @@
                 }
 
                 if (destSize == 4) {
-                    argBits = (uint32_t)arg;
+                    int32_t i_arg = (int32_t)arg;
+                    argBits = *((uint32_t*)&i_arg);
                 } else {
-                    argBits = (uint64_t)arg;
+                    int64_t i_arg = (int64_t)arg;
+                    argBits = *((uint64_t*)&i_arg);
                 }
                 int destHiIndex = destStart + (i + 1) * destSizeBits - 1;
                 int destLoIndex = destStart + (i + 0) * destSizeBits;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to