From: Mitchell R Whorlow
Subject: problem with ACL Trial Edition
Date: 
Message-ID: <86d7bukrhx.fsf@mrw.res-hall.nwu.edu>
I have written two simple encode and decode functions that run fine in
CMUCL, but fail on certain input with ACL 6 Trial.  Is there something
in my code that causes the behavior seen in the logs below?

(defun string-shift-left (string)
  (do* ((i 0 (1+ i))
	(j 1 (1+ j)))
      ((= j (length string)) string)
    (rotatef (aref string i)
	     (aref string j))))

(defun string-shift-right (string)
  (do* ((i (1- (length string)) (1- i))
	(j (1- i) (1- j)))
      ((= i 0) string)
    (rotatef (aref string j)
	     (aref string i))))

(defun decode (in-string)
  (with-input-from-string
   (input in-string)
   (with-output-to-string
     (output)
     (do ((word (read input nil nil)
		(read input nil nil))
	  (first-word-p t nil))
	 ((null word) output)
       (unless first-word-p
	 (write-char #\Space output))
       (write-string (string-shift-right (symbol-name word))
		     output)))))

(defun encode (in-string)
  (with-input-from-string
   (input in-string)
   (with-output-to-string
     (output)
     (do ((word (read input nil nil)
		(read input nil nil))
	  (first-word-p t nil))
	 ((null word) output)
       (unless first-word-p
	 (write-char #\Space output))
       (write-string (string-shift-left (symbol-name word))
		     output)))))

CMUCL log ("comp lang lisp" and "computer program" work just fine):

Starting /usr/local/bin/cmucl ...
CMU Common Lisp 18b, running on dhcp085172.res-hall.nwu.edu
Send questions and bug reports to your local CMU CL maintainer, or to
··········@cons.org. and ·········@cons.org. respectively.
Loaded subsystems:
    Python 1.0, target Intel x86
    CLOS based on PCL version:  September 16 92 PCL (f)
* ;;;Compile from defun string-shift-left to defun encode
  Converted STRING-SHIFT-LEFT.
Converted STRING-SHIFT-RIGHT.
Converted DECODE.
Converted ENCODE.
Compiling LAMBDA NIL: 
Compiling Top-Level Form: 
ENCODE
* (encode "comp lang lisp")
"OMPC ANGL ISPL"
* (decode "OMPC ANGL ISPL")
"COMP LANG LISP"
* (decode (encode "computer program"))
"COMPUTER PROGRAM"

ACL log (fails on "comp lang lisp" but succeeds on "computer
program"):

Starting /usr/local/acl6/alisp ...
WARNING: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: Allegro CL will expire in 21 days.
WARNING: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
International Allegro CL Trial Edition
6.0 [FreeBSD] (Oct 28, 2000 19:46)
Copyright (C) 1985-2000, Franz Inc., Berkeley, CA, USA.  All Rights
Reserved.
This copy of Allegro CL is licensed to:
   Mitchell Whorlow, Northwestern University

;; Optimization settings: safety 1, space 1, speed 1, debug 2.  For a
;; complete description of all compiler switches given the current
;; optimization settings evaluate (EXPLAIN-COMPILER-SETTINGS).
...
CL-USER(9): ;;;Compile from defun string-shift-left to defun encode
Warning: While compiling these undefined functions were referenced:
STRING-SHIFT-RIGHT, STRING-SHIFT-LEFT.  ENCODE

CL-USER(10): (encode "comp lang lisp")
Error: Received signal number 4 (Illegal instruction) 
[condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL]

Restart actions (select using :continue):
 0: Return to Top Level (an "abort" restart)
 1: Abort #<PROCESS Initial Lisp Listener>
[1] CL-USER(11): [1] CL-USER(11): 
...
CL-USER(28): (decode (encode "computer program"))
"COMPUTER PROGRAM"
From: Steven M. Haflich
Subject: Re: problem with ACL Trial Edition
Date: 
Message-ID: <3AA65759.B70CDA4A@pacbell.net>
See ANS 10.2.11 symbol-name, which prohibits modifying a string
returned by symbol-name.

Mitchell R Whorlow wrote:

>        (write-string (string-shift-right (symbol-name word))
>                      output)))))

Although CMU didn't signal error (perhaps because its symbol-name
strings aren't in pure space) it might be that after you execute
your code, intern will stop finding symbols reliably...