← 输入框|github.com|刷新
Skip to content

Verify pass fails in the symbolic pass #2532

Closed

Description

@certik
from lpython import S
from sympy import Symbol, pi

def test_main():
    x: S = Symbol('x')
    if x == pi:
        print('hi')

test_main()

This gives:

$ lpython a.py --enable-symengine
ASR verify pass error: ASR verify: Function test_main doesn't depend on basic_eq but is found in its dependency list.
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  File "/Users/ondrej/repos/lpython/src/bin/lpython.cpp", line 1872
    err = compile_python_to_object_file(arg_file, tmp_o, runtime_library_dir,
  File "/Users/ondrej/repos/lpython/src/bin/lpython.cpp", line 824
    res = fe.get_llvm3(*asr, pass_manager, diagnostics, infile);
  File "/Users/ondrej/repos/lpython/src/lpython/python_evaluator.cpp", line 71
    run_fn, infile);
  File "/Users/ondrej/repos/lpython/src/libasr/codegen/asr_to_llvm.cpp", line 9276
    pass_manager.apply_passes(al, &asr, co.po, diagnostics);
  File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_manager.h", line 299
    apply_passes(al, asr, _passes, pass_options, diagnostics);
  File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_manager.h", line 164
    throw LCompilersException("Verify failed in the pass: "
LCompilersException: Verify failed in the pass: symbolic

Activity

  1. certik commented on Feb 14, 2024

    @certik
    ContributorAuthor

    The problem is that the if condition:

                                        (If
                                            (SymbolicCompare
                                                (Var 3 x)
                                                Eq
                                                (IntrinsicScalarFunction
                                                    SymbolicPi
                                                    []
                                                    0
                                                    (SymbolicExpression)
                                                    ()
                                                )
                                                (Logical 4)
                                                ()
                                            )
                                            [(Print
                                                [(StringConstant
                                                    "hi"
                                                    (Character 1 2 ())
                                                )]
                                                ()
                                                ()
                                            )]
                                            []
                                        )]

    becomes missing after the symbolic pass, so the basic_eq is still in the dependency list, but is not being used, and thus the verify fails.

  2. anutosh491 commented on Feb 20, 2024

    @anutosh491
    Collaborator

    Fixed by #2535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions