I have uploaded a fix. ECL will only constant fold a function when the output is an externalizable value or the function which is evaluated signals an error.

Juanjo

On Mon, Dec 19, 2011 at 7:00 PM, Waldek Hebisch <hebisch@math.uni.wroc.pl> wrote:
Put the the following line in a file:

(DEFUN |nangenericcomplex| () (PROG () (RETURN (/ 1.0 (COMPLEX 0.0)))))

And then try to compile-file it:

> (compile-file "sfsfun.clisp")

;;; Loading #P"/var/tmp/hebisch/usr/lib/ecl-11.1.1/cmp.fas"
;;;
;;; Compiling sfsfun.clisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Compiling (DEFUN |nangenericcomplex| ...).
;;; End of Pass 1.
;;; Emitting code for |nangenericcomplex|.
;;; Internal error:
;;;   ** Cannot print object #<single-float quiet NaN> readably.
NIL
NIL
NIL

FriCAS uses such a function to raise floating point errors
when appropriate.  In principle I could divide by "runtime"
zero (I have one at hand as just before call to |nangenericcomplex|
I have test which checks that number to be used as divisor is zero).
But having separate function seems clearer.  And some day compiler
may be smart enough to realize that "runtime" zero is a zero and
try to constant fold it...

--
                             Waldek Hebisch
hebisch@math.uni.wroc.pl

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list



--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com