chiark / gitweb /
src/method-impl.lisp (compute-method-entry-functions): Fix varargs handling.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 15 Dec 2015 17:04:00 +0000 (17:04 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:39 +0000 (14:40 +0100)
The `convert-stmts' in `finish-entry' didn't cover the trailing
`va_end', with the possible result of a premature return.

src/method-impl.lisp

index 4c694e15f37b643f5da07f137f7fdb2d54e8fa45..6f22a142f92f9e487ca7858db4758fd3ff4a26e7 100644 (file)
@@ -455,13 +455,15 @@ (defmethod compute-method-entry-functions ((method basic-effective-method))
                                               . raw-entry-args))))
                   (codegen-push codegen)
                   (ensure-var codegen *sod-ap* (c-type va-list))
-                  (emit-inst codegen
-                             (make-va-start-inst *sod-ap*
-                                                 (argument-name parm-n)))
                   (convert-stmts codegen entry-target return-type
                                  (lambda (target)
-                                   (deliver-expr codegen target call)))
-                  (emit-inst codegen (make-va-end-inst *sod-ap*))
+                                   (emit-inst codegen
+                                              (make-va-start-inst
+                                               *sod-ap*
+                                               (argument-name parm-n)))
+                                   (deliver-expr codegen target call)
+                                   (emit-inst codegen
+                                              (make-va-end-inst *sod-ap*))))
                   (codegen-pop-function codegen main main-type))))))
 
       ;; Generate the method body.  We'll work out what to do with it later.