question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Segmentation Fault

See original GitHub issue

Hi,

I am trying get a model from z3 for an array, and end up with following error: z3.z3types.Z3Exception: Z3 application expected

Formula is simple: “”" (set-logic QF_AUFBV ) (declare-fun A-data () (Array (_ BitVec 32) (_ BitVec 8) ) ) (assert (and (= (_ bv108 8) (select A-data (_ bv2 32) ) ) (= (_ bv101 8) (select A-data (_ bv1 32) ) ) ) ) (check-sat) “”"

Full Code:

DEMO_SMTLIB=\
"""
(set-logic QF_AUFBV )
(declare-fun A-data () (Array (_ BitVec 32) (_ BitVec 8) ) )
(assert (and (=  (_ bv108 8) (select  A-data (_ bv2 32) ) )  (=  (_ bv101 8) (select  A-data (_ bv1 32) ) ) ) )
(check-sat)
"""

parser = SmtLibParser()
script = parser.get_script(cStringIO(DEMO_SMTLIB))
f = script.get_last_formula()
print(f)
model = get_model(f, solver_name="z3")
print(model)

Stack Trace: Traceback (most recent call last): File “test.py”, line 98, in <module> print(model) File “/home/rshariffdeen/.local/lib/python3.6/site-packages/pysmt/solvers/solver.py”, line 496, in str return “\n”.join([ “%s := %s” % (var, value) for (var, value) in self]) File “/home/rshariffdeen/.local/lib/python3.6/site-packages/pysmt/solvers/solver.py”, line 496, in <listcomp> return “\n”.join([ “%s := %s” % (var, value) for (var, value) in self]) File “/home/rshariffdeen/.local/lib/python3.6/site-packages/pysmt/solvers/z3.py”, line 97, in iter yield pysmt_d, self.get_value(pysmt_d) File “/home/rshariffdeen/.local/lib/python3.6/site-packages/pysmt/solvers/z3.py”, line 83, in get_value return self.converter.back(z3_res, model=self.z3_model) File “/home/rshariffdeen/.local/lib/python3.6/site-packages/pysmt/solvers/z3.py”, line 473, in back for i in xrange(current.num_args()): File “/home/rshariffdeen/workspace/z3/build/python/z3/z3.py”, line 961, in num_args _z3_assert(is_app(self), “Z3 application expected”) File “/home/rshariffdeen/workspace/z3/build/python/z3/z3.py”, line 92, in _z3_assert raise Z3Exception(msg) z3.z3types.Z3Exception: Z3 application expected

Has anyone else encountered this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mikandcommented, Jan 8, 2019

Great! In the meantime, I created a branch to port pysmt to Z3 4.8.4 (see #550 if you are interested). It seems to work, but It will take a while before merging into master.

0reactions
mikandcommented, Jan 21, 2019

#550 closed the issue in master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation fault - Wikipedia
Segmentation faults are a common class of error in programs written in languages like C that provide low-level memory access and few to...
Read more >
c++ - What is a segmentation fault? - Stack Overflow
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to...
Read more >
Identify what's causing segmentation faults (segfaults)
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core...
Read more >
Core Dump (Segmentation fault) in C/C++ - GeeksforGeeks
When a piece of code tries to do read and write operation in a read only location in memory or freed block of...
Read more >
What Is a Segmentation Fault in Linux?
A segmentation fault, or segfault, is a memory error in which a program tries to access a memory address that does not exist...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found