From 26e3ad82a37646da2ebb8f90f369f84c071eb1f8 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sat, 17 Feb 2018 19:44:02 -0800
Subject: [PATCH] Fix #60: `C::%UNARY-FROUND` is undefined

Remove the symbol `C::%UNARY-FROUND` and just let the compiler package
inherit it from the kernel package.

* src/bootfiles/21c/boot-2018-02-1.lisp
    * Use this to bootstrap the change (by uninterning the symbol)
* src/code/float.lisp
    * Just export %unary-fround
* src/general-info/release-21d.md
    * Update
* tests/issues.lisp
    * Add test for this issue
---
 src/bootfiles/21c/boot-2018-02-1.lisp |  5 +++++
 src/code/float.lisp                   |  2 +-
 src/general-info/release-21d.md       |  9 +++++----
 tests/issues.lisp                     | 13 ++++++++++++-
 4 files changed, 23 insertions(+), 6 deletions(-)
 create mode 100644 src/bootfiles/21c/boot-2018-02-1.lisp

diff --git a/src/bootfiles/21c/boot-2018-02-1.lisp b/src/bootfiles/21c/boot-2018-02-1.lisp
new file mode 100644
index 000000000..fd8227830
--- /dev/null
+++ b/src/bootfiles/21c/boot-2018-02-1.lisp
@@ -0,0 +1,5 @@
+;; Get rid of incorrect symbol c::%unary-fround and just inherit
+;; %unary-fround from the kernel package.
+(ext:without-package-locks
+  (unintern 'c::%unary-fround "C"))
+(export 'kernel::%unary-fround "KERNEL")
diff --git a/src/code/float.lisp b/src/code/float.lisp
index 4616fedf9..57e377cf2 100644
--- a/src/code/float.lisp
+++ b/src/code/float.lisp
@@ -23,7 +23,7 @@
 	  %unary-ftruncate/single-float %unary-ftruncate/double-float))
 
 #-x87
-(export '(%unary-fround/single-float %unary-fround/double-float))
+(export '(%unary-fround %unary-fround/single-float %unary-fround/double-float))
 
 (in-package "LISP")
 (export '(least-positive-normalized-short-float
diff --git a/src/general-info/release-21d.md b/src/general-info/release-21d.md
index 87c36a698..b15456bb3 100644
--- a/src/general-info/release-21d.md
+++ b/src/general-info/release-21d.md
@@ -29,10 +29,11 @@ public domain.
   * ANSI compliance fixes:
   * Bug fixes:
   * Gitlab tickets:
-    * ~~~#50~~~ CLX (Hemlock) fails to run.
-    * ~~~#49~~~ CLM crashes
-    * ~~~#47~~~ Backquate and multiple splices
-    * ~~~#59~~~ Incorrect type-derivation for `decode-float`
+    * ~~#50~~ CLX (Hemlock) fails to run.
+    * ~~#49~~ CLM crashes
+    * ~~#47~~ Backquate and multiple splices
+    * ~~#59~~ Incorrect type-derivation for `decode-float`
+    * ~~#60~~ The function `C::%UNARY-FROUND` is undefined
   * Other changes:
   * Improvements to the PCL implementation of CLOS:
   * Changes to building procedure:
diff --git a/tests/issues.lisp b/tests/issues.lisp
index 75284cb3b..5458531c0 100644
--- a/tests/issues.lisp
+++ b/tests/issues.lisp
@@ -503,4 +503,15 @@
 		     (c::decode-float-exp-derive-type-aux
 		      (c::specifier-type `(single-float ,arg-lo ,arg-hi)))
 		     arg-lo
-		     arg-hi))))
\ No newline at end of file
+		     arg-hi))))
+
+(define-test issue.60
+  (:tag :issues)
+  (let ((c14 (compile nil #'(lambda (x)
+			      (fround (the (member 1.0 2d0) x))))))
+    (assert-equalp
+     (values 1.0 0.0)
+     (funcall c14 1.0))
+    (assert-equalp
+     (values 2d0 0d0)
+     (funcall c14 2d0))))
-- 
GitLab