login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Submitted by : (unknown) at: 2007-11-17T22:34:02-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

In defintrf.spad, function findRealZero, we have the following code:

   select_!(keeprec?(i.halfinf.endpoint, #1), l)

The call to keeprec? gets lifted into a top level DEFUN in the generated Lisp but the Union/Record tags are being confused with free variables. This results in the following Lisp code (thanks to Gregory Vanuxem for pointing this out):

   (SPADCALL 
      (CONS #'|DFINTTLS;findRealZero!1|
         (VECTOR $ |dir| |endpoint| |i|)) ...)

As the tags |dir| and |endpoint| have been confused with free variables, the Lisp code now references unbound symbols.

A fix is to ensure that the code emmited when accessing a Union field properly macroexpands type expressions so that tags are explicitly quoted, and this recognized by the compiler as literals rather than evalable identifiers. This amounts to the following change in buildom.boot.pamphlet, in the functions mkUnionFunList and mkNewUnionFunList:

  --- buildom.boot.pamphlet       2007-07-08 14:29:00.000000000 -0400
  +++ buildom.boot.pamphlet.sxw   2007-07-08 14:29:34.000000000 -0400
  @@ -318,7 +318,7 @@
                        ['XLAM,["#1"],['PROG1,['QCDR,"#1"],
                          ['check_-union,['QEQCAR,"#1",i],type,"#1"]]]
                    ['XLAM,["#1"],['PROG2,['LET,gg,"#1"],['QCDR,gg],
  -                     ['check_-union,['QEQCAR,gg,i],type,gg]]]
  +                     ['check_-union,['QEQCAR,gg,i],MACROEXPAND type,gg]]]
     [cList,e]

   mkEnumerationFunList(nam,['Enumeration,:SL],e) ==
  @@ -361,7 +361,7 @@
                    ref:=gg
                    q:= substitute(gg,"#1",p)
                 ['XLAM,["#1"],['PROG2,['LET,gg,"#1"],ref,
  -                   ['check_-union,q,t,gg]]]
  +                   ['check_-union,q,MACROEXPAND t,gg]]]
               downFun() ==
                  p is ['EQCAR,x,.] =>
                    ['XLAM,["#1"],['QCDR,"#1"]]

On 08 Jul 2007 14:48:27 -0400 Stephen Wilson wrote:

The MACROEXPAND fix as detailed in a prior email seems workable. I have tested the change but wish to continue with some more tests. I propose the attached patches for testing.

The original `fix', checking that a free variable is bound in the environment, might still be useful. The compiler is surely lacking in assertions and self checks. Will incorporate the change into my own branches and possibly submit a patch in the future.

buildom.boot.pamphlet.patch

changelog.patch

10 Jul 2007

The original fix had problems. It took the approach of `normalizing' the input so that compWithMappingMode could swallow it. Unfortunately it did not normalize all such expressions. It fixed the defintrf.spad bug, but not the bug in general.

The following change appears to be a general fix. It makes compWithMappingMode lift only the identifiers it can prove are bound. Since record and union fields are not bound identifiers, they are properly ignored.

20070710-compiler.boot.pamphlet.patch

fixed and commited --swilson, Sat, 14 Jul 2007 15:29:48 -0500 reply
Status: testing => pending (next release)

Status: pending (next release) => fix proposed

see http://groups.google.com/group/fricas-devel/msg/43c2a2bd6e64fc13

Fixed on OpenAxiom

Status: fix proposed => closed




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: