[Openmcl-devel] errors for wrong number of argumments?

Gary Byers gb at clozure.com
Wed May 29 14:22:48 UTC 2013


This is behaving as if something like:

(declaim (optimize (speed 3) (safety 0)))

is in effect.  I'd be very surprised if the Windows version of CCL 1.9
was built that way (and no one noticed ...), but the machine that I
use to run a Windows VM is packed at the moment and I can't easily
check that.

You can see the global optimization settings via CCL:DECLARATION-INFORMATION:

? (ccl:declaration-information 'optimize nil)
((SPEED 1) (SAFETY 1) (COMPILATION-SPEED 1) (SPACE 1) (DEBUG 1))

and you might want to run CCL with the -n or --no-init option to see if
something in your init file is affecting those settings.

It's fairly common for third-party packages to say things like:

(declaim (optimize (speed 3) (safety 0)))

which means something like:

(eval-when (:compile-toplevel :load-toplevel :execute)
   (proclaim '(optimize (speed 3) (safety 0))))

only the spec allows implementations to limit-the extent of the
compile-time effects of a declamation to that of the containing
call to COMPILE-FILE (and many/most/all implementations do so).  The
spec doesn't say anything about implementations limiting the extent
of the load-time effects of DECLAIM, though many/most/almost all
do so (and at least one notes that this behavior is non-compliant.)

People who use

(declaim (optimize ...))

almost certainly don't expect the effects of that declamation to
persist after the containing file is LOADED; I've been waiting for
them to realize this for 10 years or so but am starting to suspect that
the situation isn't getting better.  As the 1.9 release notes mention,
you can set CCL:*LOAD-PRESERVES-OPTIMIZATION-SETTINGS* to a non-nil
value before loading code which (likely unintentionally) modifies those
settings.

If this is a case of CCL for Windows having been built with aggressive/unsafe
optimization settings in effect, that should be fixed; until it is, you
can work around it by doing:

(declaim (optimize (speed 1) (safety 1) (debug 1) (space 1) (compilation-speed 1)))

in your init file (and doing so may make it clear that it's useful for DECLAIM's
load-time side-effects to be pervasive and persistent.)


On Wed, 29 May 2013, Barton Willis wrote:

> 64 bit CCL 1.9  under Microsoft Windows--error for (add 42) (OK), but no error for (add 1 2 3) (not OK)
>
> $ wx86cl64
> Welcome to Clozure Common Lisp Version 1.9-r15765  (WindowsX8664)!
> ? (defun add (a b) (+ a b))
> ADD
> ? (add 42)
>> Error: The value (42) is not of the expected type NUMBER.
>> While executing: CCL::+-2, in process listener(1).
>> Type :POP to abort, :R for a list of available restarts.
>> Type :? for other options.
> 1 > (add 1 2 3)
> 5
> 1 > (quit)
>
> 32 bit CCL 1.9 under Microsoft Windows --spurious value for (add 42) (not OK), and error for (add 1 2 3) (OK):
>
> $ wx86cl
> Welcome to Clozure Common Lisp Version 1.9-r15764  (WindowsX8632)!
> ? (defun add (a b) (+ a b))
> ADD
> ? (add 42)
> 84
> ? (add 1 2 3)
>> Error: Fault during read of memory address #x4
>> While executing: ADD, in process listener(1).
>> Type :POP to abort, :R for a list of available restarts.
>> Type :? for other options.
> 1 >
>
>
> --Barton (Maxima developer)
>
>
>
>
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list