[Ecls-list] Error on compiling type declarations without the type

Zach elzacho at gmail.com
Fri Jul 11 17:47:22 UTC 2008


Hey, list,

I only did a cursory search through the bug tracker and list archive so
sorry if this is a known issue...

Compilation of functions that contain type declarations of unions which omit
`type' from the car of the declaration appear not to work in ecl-0.9{i,j,k}
(I pulled k from git on 7-10-2008).  E.g (declare (type (or type1 type2)
var)) seems to work fine, but without the `type': (declare ((or type1 type2)
var)) signals an error on compile.  This comes up if you want to build
Alexandria.  I didn't know it was valid CL to drop the `type', but after
looking at the spec, it seems that it is.  See the (attempted) compilation
of FUNC2 below.

smithzv at marco:~$ rlwrap ecl -norc
ECL (Embeddable Common-Lisp) 0.9k (CVS 2008-06-19 17:09)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Top level.
> (defun func1 (x) (declare (type (or fixnum null) x)) x)
FUNC1
> (compile 'func1)
;;; Loading #P"/home/smithzv/usr/lib/ecl/cmp.fas"
;;; Loading #P"/home/smithzv/usr/lib/ecl/sysfun.lsp"
;;; End of Pass 1.
;;; Note: Replacing variable G123 by its value
;;; Calling the C compiler...
;;; Note: Invoking external command:
;;; gcc  -D_GNU_SOURCE -g -O2 -fPIC  -Dlinux -O
"-I/home/smithzv/usr/include/" -w -c "/home/smithzv/ECL001VBe9Ah.c" -o
"/home/smithzv/ECL001VBe9Ah.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/smithzv/ECL001VBe9Ah.fas" -L"/home/smithzv/usr/lib/"
"/home/smithzv/ECL001VBe9Ah.o"  -shared    -lecl -ldl  -lm   -lgmp
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
FUNC1
NIL
NIL
> (func1 5)
5
> (defun func2 (x) (declare ((or fixnum null) x)) x)
FUNC2
> (func2 5)
5
> (compile 'func2)
Syntax error in declaration (DECLARE ((OR FIXNUM NULL) X))
Broken at SI:BYTECODES.No restarts available.
Broken at SI:BYTECODES.
>> :pop
Top level.
> (defun func3 (x) (declare (fixnum x)) x)
FUNC3
> (compile 'func3)
;;; End of Pass 1.
;;; Note: Replacing variable G127 by its value
;;; Calling the C compiler...
;;; Note: Invoking external command:
;;; gcc  -D_GNU_SOURCE -g -O2 -fPIC  -Dlinux -O
"-I/home/smithzv/usr/include/" -w -c "/home/smithzv/ECL00381xSWf.c" -o
"/home/smithzv/ECL00381xSWf.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/smithzv/ECL00381xSWf.fas" -L"/home/smithzv/usr/lib/"
"/home/smithzv/ECL00381xSWf.o"  -shared    -lecl -ldl  -lm   -lgmp
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
FUNC3
NIL
NIL
> (func3 5)
5
>


Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20080711/6a681587/attachment.html>


More information about the ecl-devel mailing list