master: x86-64: fix debugger access to stack complex double-floats

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  4d06d766bb133ab113458de91bf71424a5b2aa84 (commit)
      from  ffb6f743c0332193a0ae65ff9746a09afd656d18 (commit)

- Log -----------------------------------------------------------------
commit 4d06d766bb133ab113458de91bf71424a5b2aa84
Author: Stas Boukarev <[email protected]>
Date:   Thu Aug 6 01:50:54 2026 +0300

    x86-64: fix debugger access to stack complex double-floats
    
    Fixes lp#2162932
---
 src/code/debug-int.lisp | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp
index 4e4bf26c0..0ed0f44cb 100644
--- a/src/code/debug-int.lisp
+++ b/src/code/debug-int.lisp
@@ -2616,9 +2616,11 @@
           (sap-ref-single nfp (number-stack-offset 4)))))
       (#.complex-double-stack-sc-number
        (with-nfp (nfp)
-         (complex
-          (sap-ref-double nfp (number-stack-offset))
-          (sap-ref-double nfp (number-stack-offset 8)))))
+         (let ((offset (number-stack-offset #+stack-grows-downward-not-upward
+                                            (- sb-vm:n-word-bytes))))
+           (complex
+            (sap-ref-double nfp offset)
+            (sap-ref-double nfp (+ offset 8))))))
       #+long-float
       (#.complex-long-stack-sc-number
        (with-nfp (nfp)
@@ -2898,16 +2900,18 @@
                (the single-float (realpart value)))))
       (#.complex-double-stack-sc-number
        (with-nfp (nfp)
-         (setf (sap-ref-double nfp (number-stack-offset))
-               #+(or x86 x86-64)
-               (realpart (the (complex double-float) value))
-               #-(or x86 x86-64)
-               (the double-float (realpart value)))
-         (setf (sap-ref-double nfp (number-stack-offset 8))
-               #+(or x86 x86-64)
-               (imagpart (the (complex double-float) value))
-               #-(or x86 x86-64)
-               (the double-float (realpart value)))))
+         (let ((offset (number-stack-offset #+stack-grows-downward-not-upward
+                                            (- sb-vm:n-word-bytes))))
+           (setf (sap-ref-double nfp offset)
+                 #+(or x86 x86-64)
+                 (realpart (the (complex double-float) value))
+                 #-(or x86 x86-64)
+                 (the double-float (realpart value)))
+           (setf (sap-ref-double nfp (+ offset 8))
+                 #+(or x86 x86-64)
+                 (imagpart (the (complex double-float) value))
+                 #-(or x86 x86-64)
+                 (the double-float (realpart value))))))
       #+long-float
       (#.complex-long-stack-sc-number
        (with-nfp (nfp)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.