From: Nigel O'Brian
Subject: Problem with AKCL Lisp/C interface on IBM RS6000
Date: 
Message-ID: <1991Aug21.005328.27232@metro.ucc.su.OZ.AU>
I'd be very grateful for any suggestions on the following problem.  I
recently compiled AKCL (level 1.592) on an IBM RS6000 (AIX 3.1.5).
Compilation went flawlessly (except I removed instructions to link in
\spad (Scratchpad?) modules in the rios.defs file). Otherwise the
official distribution was untouched. I've had no problem running or
compiling pure lisp programs up to several hundred lines.  When I
try to link in some C code most simple examples are OK, but I also
start to get some mysterious errors. The simplest context in which I
can produce an error is the following, saved as "bug.lsp":

----------------------------cut--------------------------
(Clines
" double weird (double a, double b, double c, double d, double e)"
" { return (a+b+c+d+e); }"
)

(defentry weird-lisp (double double double double double) (double weird))
----------------------------cut------------------------------

Now we try it out:
....................................................................
$ kcl
AKCL (Austin Kyoto Common Lisp)  Version(1.592) Wed Jul 31 15:00:51 EET 1991
Contains Enhancements by W. Schelter

>(compile-file "bug")
Compiling bug.lsp.
End of Pass 1.  
End of Pass 2.  
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling bug.
#"bug.o"

>(load "bug")
Loading bug.o
start address -T 201e46ec Finished loading bug.o
628

>(weird-lisp 1.0 2.0 3.0 4.0 5.0)

Error: NIL is not a VECTOR
Fast links are on: do (use-fast-links nil) for debugging
Error signalled by WEIRD-LISP.
Broken at WEIRD-LISP.  Type :H for Help.
....................................................................

The strangest thing here is that if I redefine the function with 4
arguments instead of 5, then everything is OK and I get the sum of the
four arguments. Similarly if I replace 'double' by 'int' everything
works fine, and returns the sum of 5 integer arguments. Replacing
'double' by 'float' leaves the same problem however. If I replace 
the 'double' args by 'int' one at a time (starting with the last)
-- each time modifying the defentry appropriately --
the problem goes away when the args are 3 doubles + 2 ints.
Replace doubles by ints starting with the first and the problem
disappears straight away (with 1 int + 4 doubles).

The AKCL lisp/C interface is very nice, but this error comes up quite
frequently in the code I'm using. It is also generated in some cases
when C functions call other C functions, and disappears when the inner
call is removed.

I contacted another user running AKCL on an RS6000 (this time at
level 492). With the same file he gets:
....................................................................
>(compile-file "bug")
Compiling bug.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling bug.
#"bug.o"

>(load "bug")
Loading bug.o
10: unsupported relocation type.
Error: The relocation type was unknown
Error signalled by LOAD.
Broken at LOAD.  Type :H for Help.
....................................................................
Our local IBM representative has not come up with any alternative
version of Common Lisp on this machine. Any news of Lucid CL?
======================================================================
Nigel O'Brian                         ·····@frog.maths.su.oz.au
School of Mathematics,                ········@maths.su.oz.au
University of Sydney                  (ph (02) 692-2005)
Sydney NSW 2006, Australia