These are chat archives for symengine/symengine

16th
Apr 2018
Gary Tan
@tgn3000
Apr 16 2018 01:32

Dear devs, just found another issue that seems a bug:

#include <symengine/add.h>
#include <symengine/visitor.h>

typedef SymEngine::RCP<const SymEngine::Symbol> SymbolType;
typedef SymEngine::RCP<const SymEngine::Basic> BasicType;

class A {
 public:
  static const BasicType s;

  static BasicType _create_s();
};

const BasicType A::s = A::_create_s();

BasicType A::_create_s()
{
  return neg(SymEngine::symbol("s"));
}

int main()
{
  return 0;
}

This gives

terminate called after throwing an instance of 'Teuchos::NullReferenceError'
  what():  /home/mujin/Repos/symengine-tgn/symengine/utilities/teuchos/Teuchos_RCPNode.cpp:723:

Throw number = 1

Throw test that evaluated to true: true

Teuchos::RCP<SymEngine::Basic const> : You can not call operator->() or operator*() if getRawPtr()==0!
Aborted

Could someone please briefly check if it is a bug or just my misuse? In the former case I will fill the issue form. Thanks!

If it is
BasicType A::_create_s() { return SymEngine::symbol("s"); }
then it is fine.
Gary Tan
@tgn3000
Apr 16 2018 02:17
If I replace one by integer(1) and minus_one by integer(-1) in mul.cpp, then the bug is gone. Would these global variables defined in constants.cpp somehow cause troubles?
Isuru Fernando
@isuruf
Apr 16 2018 02:20
That's probably the cause of the issue. I'll have a look
Please open an issue for it
Gary Tan
@tgn3000
Apr 16 2018 02:21
Sure, thx
Christopher Rackauckas
@ChrisRackauckas
Apr 16 2018 04:45
@isuruf it seems using DiffEqProblemLibrary stalls after the update. Is there anything I should expect changed, like Unicode support?
Isuru Fernando
@isuruf
Apr 16 2018 04:47
julia v0.6?
Christopher Rackauckas
@ChrisRackauckas
Apr 16 2018 04:52
yes
only on windows it seems
Christopher Rackauckas
@ChrisRackauckas
Apr 16 2018 05:14
seems like it's due to precompilation
__precompile__()

module DiffEqProblemLibrary

using ParameterizedFunctions

lotka = @ode_def_nohes LotkaVolterra begin
  dx = a*x - b*x*y
  dy = -c*y + d*x*y
end a b c d

end # module
did something become a pointer, making a SymEngine.Basic no longer precompilable?
Isuru Fernando
@isuruf
Apr 16 2018 05:15
SymEngine.Basic was never precompilable
Christopher Rackauckas
@ChrisRackauckas
Apr 16 2018 05:16
:-/ it worked before
okay, I can work around it
Isuru Fernando
@isuruf
Apr 16 2018 05:18
It wasn't. See JuliaDiffEq/DiffEqBiological.jl#25
Christopher Rackauckas
@ChrisRackauckas
Apr 16 2018 05:20
oh
I wonder how I got away with it in another library for so long :-/