sci2exp() crashes SCILAB when converting a function. Also other problems.
Reported by Ross Piltz
BUG DESCRIPTION:
----------------
Here is an interesting one. Three SCILAB versions, three different failures.
V5.4.1: Correct for Q2,Q3,Q4 wrong for Q1.
V6.0.1: Correct for Q1,Q2,Q3 but Q4 crashes SCILAB.
V6.0.2: Fails for all functions, with identical error messages:
I wonder if these bugs were fixed, would Q4 still crash SCILAB?
HOW TO REPRODUCE THE BUG:
-------------------------
// First define the functions:
function Q1
a.b
endfunction
function Q2
a(1)
endfunction
function Q3
a(1).b
endfunction
function Q4
a.b(1)
endfunction
// Next try sci2exp() on each function:
sci2exp(Q1)
sci2exp(Q2)
sci2exp(Q3)
sci2exp(Q4)
RESULTS:
--------
----------------------------
scilab-5.4.1 !ICC x64 tk modelicac release Mar 29 2013 17:58:03 !
createfun(["[]=%fun()";" a(''b'')"]) << Wrong Answer
createfun(["[]=%fun()";" a(1)"])
createfun(["[]=%fun()";" a(1).b"])
createfun(["[]=%fun()";" a.b(1)"])
----------------------------
----------------------------
scilab-6.0.1 !VC++ x64 tk modelicac release Feb 15 2018 10:12:53 !
createfun(["[] = %fun()";"a.b;"]) << Correct answer
createfun(["[] = %fun()";"a(1);"])
createfun(["[] = %fun()";"a(1).b;"])
The Q4 function <<CRASHES SCILAB>>
----------------------------
----------------------------
scilab-6.0.2 !VC++ x64 tk modelicac release Feb 14 2019 10:31:37 !
Same error for all four functions:
at line 77 of function sci2exp ( C:\Program Files\scilab-6.0.2\modules\string\macros\sci2exp.sci line 89 )
':': Wrong type for argument 1: Real scalar expected.
----------------------------