`moose.Function` field `expr` seems to be sensitive to ordering of x0, x1, ...
Created by: subhacom
Parser is working fine. Following expressions were parsed and added to moose.Function's expr field.
- 0.00333333_x0^4/(x0^4 + 0.0007^4)-0.0166667_x1
- 0.000041667_x0^4/(x0^4+0.00003^4)-0.08333_x1
- 0.166666667_0.00001_x0^4/(x0^4+0.00003^4)-0.0083333*x1
These works fine. However follwing expression causes seg-fault.
- 0.166666667_x1_x0^4/(x0^4+0.00003^4)-0.0083333*x2
This is parsed by muparser. When changing the order of x0 and x1 in expression, it works well.
- 0.166666667_x0_x1^4/(x0^4+0.00003^4)-0.0083333*x2
In short, while parsing left to right, if x0, x1, x2 etc appears in ascending oder then it works fine, else it causes seg-fault.
Following is relevant backtrack.
#0 0x00007ffff5378b0a in mu::ParserBase::ParseCmdCodeBulk (this=0x167d518, nOffset=0, nThreadID=0) at /public/dilawars/moose3.0.1/external/muparser/muParserBase.cpp:1093
#1 0x00007ffff53782bc in mu::ParserBase::ParseCmdCode (this=0x167d518) at /public/dilawars/moose3.0.1/external/muparser/muParserBase.cpp:1010
#2 0x00007ffff537b1f7 in mu::ParserBase::ParseString (this=0x167d518) at /public/dilawars/moose3.0.1/external/muparser/muParserBase.cpp:1439
#3 0x00007ffff537bbec in mu::ParserBase::Eval (this=0x167d518) at /public/dilawars/moose3.0.1/external/muparser/muParserBase.cpp:1729
#4 0x00007ffff518cffb in Function::setExpr (this=0x167d488, eref=..., expr=...) at /public/dilawars/moose3.0.1/builtins/Function.cpp:505
#5 0x00007ffff5193a9f in EpFunc1<Function, std::string>::op (this=0xa85cf0, e=..., arg=...) at /public/dilawars/moose3.0.1/basecode/EpFunc.h:72
#6 0x00007ffff5083ed7 in SetGet1<std::string>::set (dest=..., field=..., arg=...) at /public/dilawars/moose3.0.1/pymoose/../basecode/SetGet.h:172
#7 0x00007ffff5055d82 in Field<std::string>::set (dest=..., field=..., arg=...) at /public/dilawars/moose3.0.1/pymoose/../basecode/SetGet.h:249
#8 0x00007ffff50493bf in moose_ObjId_setattro (self=0x7fffed5c8e90, attr='expr', value='0.166666667*x1*x0^4/(x0^4+0.00003^4)-0.0083333*x2')
at /public/dilawars/moose3.0.1/pymoose/melement.cpp:732
#9 0x00000000004a945b in PyObject_SetAttr (v=v@entry=<moose.Function at remote 0x7fffed5c8e90>, name='expr', value=value@entry='0.166666667*x1*x0^4/(x0^4+0.00003^4)-0.0083333*x2')
at ../Objects/object.c:1247
```~~~
Reported by: dilawar