[cmucl-help] bugs in C::SOURCE-LOCATION and string reversal

Matt Kaufmann kaufmann at cs.utexas.edu
Tue May 14 19:55:35 UTC 2013

Hello --

Thanks for the reply!  Please see replies below.

   From: Raymond Toy <toy.raymond at gmail.com>
   Date: Mon, 13 May 2013 19:18:05 -0700

   >>>>> "Matt" == Matt Kaufmann <kaufmann at cs.utexas.edu> writes:

       Matt> Hi --
       Matt> I downloaded the 2013-05 snapshot from
       Matt> http://trac.common-lisp.net/cmucl
       Matt> (http://common-lisp.net/project/cmucl/downloads/snapshots/2013/05/cmucl-2013-05-x86-linux.tar.bz2),
       Matt> and I am running into two bugs, discussed below.  The first is kind of
       Matt> a show-stopper.  It's hit me before using CMUCL 19e (so I guess it's
       Matt> been around awhile), but at that time I was able to avoid it simply by
       Matt> not running my application in a particular "mode".  I'd appreciate any
       Matt> suggestions for easily working around that first bug.  I've worked
       Matt> around the second bug, but I thought I should report it, and I do so
       Matt> at the end, below.

   First, sorry for the trouble you're having.  And thank you for
   reporting it.  If you don't report it, it can't be fixed.

You're welcome -- I feel the same way about people reporting bugs for
my system!

       Matt> The first bug pertains to C::SOURCE-LOCATION.  Below is part of the
       Matt> log, showing three errors during compilation followed by a break
       Matt> during load of the resulting compiled file.

   Hmm.  There have been some issues with source-location, but I thought
   they were fixed recently.  Apparently not.  Can I reproduce this by
   downloading and installing acl2?  A short example file instead would
   be better, but sometimes that's not so easy to do.

Yes, in fact I wanted to send you a short example file, but it was
looking like quite a challenge in this case, so I waited for
your reply.  I've spent a couple hours or so trying to shrink it, with
only modest success.  I'll send you complete instructions along with a
tarball in a separate message.

       Matt> I tried a workaround or two with the sort of approach I used below for
       Matt> the second error; but that didn't help.  Also, I don't care about
       Matt> source location information, but I didn't see a way simply to turn it
       Matt> off (as I do when compiling with CCL).

   You never care to look at backtraces and see the offending source?  I
   find that invaluable.

Yes, I look at backtraces.  But for our application, ACL2
(http://www.cs.utexas.edu/users/moore/acl2/), I look at source
functions using tags in Emacs.  Also, our application has a
read-eval-print loop in which our users define their own functions,
and that loop supports queries to locate the source file for a
user-defined function.

   I don't know of any way to turn off source-location information

Oh well; that might have provided the simplest solution to my problem.

       Matt> The second bug is in computing (reverse ""), as shown below.

   Ouch.  This is probably due to a recent change in handling of strings.

   For this particular issue, you can solve it with this:

   (in-package "LISP")
   (defmacro with-string (string &rest forms)
     `(let ((,string (if (stringp ,string) ,string (string ,string))))
	(with-array-data ((,string ,string)
			  (end (length (the vector ,string))))
	  , at forms)))

   (defun string-reverse* (sequence)
     (declare (optimize (speed 3) (space 0) (safety 0))
	      (type string sequence))
     (with-string sequence
       (let* ((length (- end start))
	      (string (make-string length))
	      (j length))
	 (declare (type kernel:index length j))
	 (when (plusp length)
	   (loop for i = start then n as n = (%glyph-f sequence i) do
	     (replace string sequence :start1 (decf j (- n i)) :start2 i :end2 n)
	     while (< n end)))

Thank you.  What advantage, if any, does this solution have over the
one I sent in my query?


   cmucl-help mailing list
   cmucl-help at cmucl.cons.org

Thank you.


More information about the cmucl-help mailing list