You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discussing implementation for visit_assert in replace_symbolic.cpp pass #2401
(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py
from lpython import S
from sympy import pi
def main0():
x: S = pi
assert(x == pi)
What we have been doing since the beginning is we
Transform the assert block using basic_str, so we basically compare strings here (where symengine_stack_variable0 stores pi) assert (basic_str(x) == basic_str(symengine_stack_variable0))
But what would be better is to do the following assert( basic_eq(x, symengine_stack_variable0) == 1)
Activity
anutosh491 commentedon Oct 31, 2023
I think the following diff should work perfectly
And I think the execution through the C backend works perfectly
anutosh491 commentedon Oct 31, 2023
However there is something wrong with the LLVM backend.
If we could debug this I think we could switch to a better way to assert things in our tests.
Thirumalai-Shaktivel commentedon Oct 31, 2023
Instead of
assert( basic_eq(x, symengine_stack_variable0) == 1), why not we just doassert( basic_eq(x, symengine_stack_variable0) ).As you can see, the declare has the return type bool in the LLVM IR
Modify to above and see if it works?
certik commentedon Oct 31, 2023
Yes, we should not be comparing strings, but rather calling
basic_eq.anutosh491 commentedon Nov 1, 2023
Thanks @Thirumalai-Shaktivel
I think this does it.