[nasm:nasm-2.15.xx] eval, float: fix the __float80e__ and __float128h__ conversions

nasm-bot for H. Peter Anvin hpa at zytor.com
Thu Aug 13 13:44:08 PDT 2020


Commit-ID:  783976666393dee5ca9f21e9a4339fd5dbf6ab0e
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=783976666393dee5ca9f21e9a4339fd5dbf6ab0e
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 13 Aug 2020 13:41:46 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 13 Aug 2020 13:41:46 -0700

eval, float: fix the __float80e__ and __float128h__ conversions

We need to add the byte offset into the floating-point value to get
the correct result for these floating point to integer conversions.

Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/eval.c      | 2 +-
 doc/changes.src | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/asm/eval.c b/asm/eval.c
index 5d6ee1e7..80fb4a28 100644
--- a/asm/eval.c
+++ b/asm/eval.c
@@ -727,7 +727,7 @@ static expr *eval_floatize(enum floatize type)
     len = fmt->bytes - fmt->offset;
     if (len > 8)
         len = 8;                /* Max 64 bits */
-    p = result + len;
+    p = result + len + fmt->offset;
     val = 0;
     for (i = len; i; i--) {
         p--;
diff --git a/doc/changes.src b/doc/changes.src
index 3de5ac7e..eb0031cc 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -34,6 +34,9 @@ operation size (e.g. \c{movsd qword [eax],xmm0}).
 \b The \c{-L+} option no longer enables \c{-Lw}, which is mainly
 useful to debug NASM crashes. See \k{opt-L}.
 
+\b Fix the \c{__float80e__} and \c{__float128h__} conversions, which
+would return the wrong bytes of the result.
+
 \S{cl-2.15.03} Version 2.15.03
 
 \b Add instructions from the Intel Instruction Set Extensions and


More information about the Nasm-commits mailing list