I discovered this when I was cleaning up the List Domain.

For
   minIndex x == 1

This function compiles to:

(PUT '|LIST;minIndex;$I;10| '|SPADreplace| '(XLAM (|x|) 1))

(SDEFUN |LIST;minIndex;$I;10| ((|x| $) ($ |Integer|)) 1)

So, when inlining "minIndex(y)", that got replaced by 1.

But what if y is an expression, like "minIndex(f := empty())"?
Then the definition of f got optimized away, later reference
of f will cause error.

This bug happens in 'checkOrderN' in exprode.spad.

This 'XLAM' optimization mechanism is like C's macro,
repeat its argument twice (or 0 times) may cause trouble.

Currently this affects minIndex of U8VEC/U16VEC/U32VEC,
minColIndex/minRowIndex of U8MAT/U16MAT/U32MAT.

I wonder what a good solution would be.  To prevent them
from being inlined or inline them more cleverly?

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to