ultimate-pa / smtinterpol

SMTInterpol interpolating SMT solver
GNU Lesser General Public License v3.0
61 stars 17 forks source link

AssertionError at Clausifier.java:1022 (check-allsat) #111

Open rainoftime opened 4 years ago

rainoftime commented 4 years ago

Hi, for the following formula, 1022.txt

smtinterpol commit 4e106c2bb

 Exception in thread "main" java.lang.AssertionError                                                                                                                                                [7/1996]
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.shareCCTerm(Clausifier.java:1022)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier$CCTermBuilder$SaveCCTerm.perform(Clausifier.java:147)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier$CCTermBuilder.convert(Clausifier.java:182) 
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.addTermAxioms(Clausifier.java:1038)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.createLinVar(Clausifier.java:1124)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.createMutableAffinTerm(Clausifier.java:1140)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.createLeq0(Clausifier.java:2066)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.convert.Clausifier.getCreateLiteral(Clausifier.java:2169)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.smtlib2.SMTInterpol.checkAllsat(SMTInterpol.java:1228)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.smtlib2.Parser$Action$.CUP$do_action(Parser.java:3154)
        at de.uni_freiburg.informatik.ultimate.smtinterpol.smtlib2.Parser.do_action(Parser.java:1317)
        at com.github.jhoenicke.javacup.runtime.LRParser.parse(Unknown Source)
jhoenicke commented 4 years ago

FIrst Analysis. The problem here is getCreateLiteral() but probably similar things can happen in other code that creates new terms without the engine running. In this case after adding term axioms it will cal run to clear the todo stack.

The problem is that creating a ccterm calls addTermAxioms recursively and that recursive call can call run, creating the same term again when inserting the axioms. In this case:

  1. A select-over-store term is created.
  2. This recursively calls addTermAxioms for the nested store term.
  3. This enqueues the select-over-store axiom and since mRunning is false, it creates the axioms immediately
  4. The select-over-store term is created again (since the outer call never finished)
  5. Finally the outer call finishes and the select-over-store term is stored, but it was already created.