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

Edit detail for #430 Bad compilation of Spad code due to `nested' one-armed if-statement revision 2 of 2

1 2
Editor: test1
Time: 2014/04/15 16:51:54 GMT+0
Note:

added:

From test1 Tue Apr 15 16:51:54 +0000 2014
From: test1
Date: Tue, 15 Apr 2014 16:51:54 +0000
Subject: 
Message-ID: <20140415165154+0000@axiom-wiki.newsynthesis.org>

Status: open => closed 


Submitted by : greg at: 2008-08-03T11:17:31-07:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

The if-then statement in this piece of code is badly compiled:

fricas
(1) -> <spad>
fricas
)abb package FOO Foo
Foo(R,VCR): Exports == Implementation where
  R   : FloatingPointSystem
  VCR : VectorCategory R
  Exports == with
    bar : (Boolean, VCR) -> Integer
    ++ bar(t,v)
  Implementation == add
    import OutputPackage
    bar(b, v) ==
      if b then
        --output("")
        for i in minIndex v..maxIndex v repeat
          if v.i <= 0 then return -1
      else
        for i in minIndex v ..maxIndex v repeat
          v.i := 1
      output(v::OutputForm)
      0</spad>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7796249095078486632-25px001.spad
      using old system compiler.
   FOO abbreviates package Foo 
------------------------------------------------------------------------
   initializing NRLIB FOO for Foo 
   compiling into NRLIB FOO 
   importing OutputPackage
   compiling exported bar : (Boolean,VCR) -> Integer
Time: 0.03 SEC.
(time taken in buildFunctor: 0)
;;; *** |Foo| REDEFINED
;;; *** |Foo| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Foo Time: 0.03 seconds
finalizing NRLIB FOO Processing Foo for Browser database: --->-->Foo(constructor): Not documented!!!! --------(bar ((Integer) (Boolean) VCR))--------- --->-->Foo(): Missing Description ; compiling file "/var/aw/var/LatexWiki/FOO.NRLIB/FOO.lsp" (written 22 NOV 2024 12:27:24 AM):
; wrote /var/aw/var/LatexWiki/FOO.NRLIB/FOO.fasl ; compilation finished in 0:00:00.308 ------------------------------------------------------------------------ Foo is now explicitly exposed in frame initial Foo will be automatically loaded when needed from /var/aw/var/LatexWiki/FOO.NRLIB/FOO

fricas
v:=new(5,0)$Vector(SF)

\label{eq1}\left[{0.0}, \:{0.0}, \:{0.0}, \:{0.0}, \:{0.0}\right](1)
Type: Vector(DoubleFloat?)
fricas
bar(false,v)
[1.0, 1.0, 1.0, 1.0, 1.0]

\label{eq2}0(2)
Type: NonNegativeInteger?

Axiom should display [1.0,1.0,1.0,1.0,1.0]? since b is set to false. If a statement is added just before the first for loop the compiler produces correct code.

Status: open => closed