Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow with long-ish seq #5471

Open
hmijail opened this issue May 21, 2024 · 9 comments
Open

Stack overflow with long-ish seq #5471

hmijail opened this issue May 21, 2024 · 9 comments
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: verifier Translation from Dafny to Boogie (translator)

Comments

@hmijail
Copy link

hmijail commented May 21, 2024

Dafny version

4.6

Code to produce this issue

const TWO_8   : int := 0x1_00
const MAX_U8 : int :=  TWO_8 - 1
newtype{:nativeType "byte"} u8 = i:int    | 0 <= i <= MAX_U8
const BYTECODE_0 : seq<u8> := [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

Command to run and resulting output

dafny measure-complexity example.dfy

What happened?

The given code verifies correctly up to dafny 4.4.
Since then, up to today's nightly (4.6+), verification fails with a Stack Overflow.

Beware, the behavior is very confusing. dafny verify example.dfy might fail a number of times, and then start working correctly for a good number of times. dafny measure-complexity --iterations 10 fails much more reliably (as soon as the 2nd iteration).

The exact contents of the stack overflow trace kept changing as I reduced the code for this issue. The last case was this one:

Stack overflow.
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_Capacity(Int32)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Grow(Int32)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].AddWithResize(System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraserArguments.OriginalOpTypes(Microsoft.Boogie.VCExprAST.VCExprNAry)
   at Microsoft.Boogie.TypeErasure.OpTypeEraserArguments.VisitBoogieFunctionOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprBoogieFunctionOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MutateSeq(System.Collections.Generic.IEnumerable`1<Microsoft.Boogie.VCExprAST.VCExpr>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.MutateSeq(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings, Int32)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.CastArgumentsToOldType(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings, Int32)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitEqOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.TypeErasure.OpTypeEraserArguments.VisitEqOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitImpliesOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitImpliesOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitImpliesOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
...
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitImpliesOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprLet, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprLet.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.OpTypeEraser.VisitImpliesOp(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprOp.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprOpVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Visit(Microsoft.Boogie.VCExprAST.VCExprNAry, Microsoft.Boogie.TypeErasure.VariableBindings)
   at Microsoft.Boogie.VCExprAST.VCExprNAry.Accept[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.Boogie.VCExprAST.IVCExprVisitor`2<System.__Canon,System.__Canon>, System.__Canon)
   at Microsoft.Boogie.VCExprAST.MutatingVCExprVisitor`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Mutate(Microsoft.Boogie.VCExprAST.VCExpr, System.__Canon)
   at Microsoft.Boogie.TypeErasure.TypeEraser.Erase(Microsoft.Boogie.VCExprAST.VCExpr, Int32)
   at Microsoft.Boogie.SMTLib.SMTLibProcessTheoremProver.VCExpr2String(Microsoft.Boogie.VCExprAST.VCExpr, Int32)
   at Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Check>d__12.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Check>d__12, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]](<Check>d__12 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.Boogie.SolverOutcome, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].Start[[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Check>d__12, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]](<Check>d__12 ByRef)
   at Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver.Check(System.String, Microsoft.Boogie.VCExprAST.VCExpr, ErrorHandler, Int32, System.Threading.CancellationToken)
   at Microsoft.Boogie.Checker+<Check>d__53.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.Boogie.Checker+<Check>d__53, Boogie.VCGeneration, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]](<Check>d__53 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.Boogie.Checker+<Check>d__53, Boogie.VCGeneration, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]](<Check>d__53 ByRef)
   at Microsoft.Boogie.Checker.Check(System.String, Microsoft.Boogie.VCExprAST.VCExpr, System.Threading.CancellationToken)
   at Microsoft.Boogie.Checker+<BeginCheck>d__54.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.Checker+<BeginCheck>d__54, Boogie.VCGeneration, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.Checker+<BeginCheck>d__54, Boogie.VCGeneration, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.Checker+<BeginCheck>d__54, Boogie.VCGeneration, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>, System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
   at Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Reset>d__13.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Reset>d__13, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Reset>d__13, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<Reset>d__13, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>, System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
   at Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<RecoverIfProverCrashedAfterReset>d__14.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<RecoverIfProverCrashedAfterReset>d__14, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<RecoverIfProverCrashedAfterReset>d__14, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibInteractiveTheoremProver+<RecoverIfProverCrashedAfterReset>d__14, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.__Canon)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.__Canon>, System.__Canon)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(System.__Canon)
   at Microsoft.Boogie.SMTLib.SMTLibSolver+<GetExceptionIfProverDied>d__12.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibSolver+<GetExceptionIfProverDied>d__12, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibSolver+<GetExceptionIfProverDied>d__12, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibSolver+<GetExceptionIfProverDied>d__12, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at Microsoft.Boogie.SMTLib.SMTLibProcess+<PingPong>d__16.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<PingPong>d__16, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<PingPong>d__16, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<PingPong>d__16, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.__Canon)
   at Microsoft.Boogie.SMTLib.SMTLibProcess+<GetProverResponse>d__21.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<GetProverResponse>d__21, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<GetProverResponse>d__21, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Boogie.SMTLib.SMTLibProcess+<GetProverResponse>d__21, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(System.__Canon)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetExistingTaskResult(System.Threading.Tasks.Task`1<System.__Canon>, System.__Canon)
   at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(System.__Canon)
   at System.Linq.AsyncEnumerable+<<ToListAsync>g__Core|424_0>d`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Linq.AsyncEnumerable+<<ToListAsync>g__Core|424_0>d`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Linq.Async, Version=6.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Linq.AsyncEnumerable+<<ToListAsync>g__Core|424_0>d`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Linq.Async, Version=6.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Linq.AsyncEnumerable+<<ToListAsync>g__Core|424_0>d`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Linq.Async, Version=6.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263]].MoveNext()
   at System.Threading.ThreadPool+<>c.<.cctor>b__86_0(System.Object)
   at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SignalCompletion()
   at SMTLib.SExprParser+<ParseSExprs>d__12.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Runtime.CompilerServices.IAsyncStateMachineBox, Boolean)
   at System.Threading.Tasks.Task.RunContinuations(System.Object)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task`1[[System.Char, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TrySetResult(Char)
   at SMTLib.SExprParser+<SkipWs>d__8.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Char, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SMTLib.SExprParser+<SkipWs>d__8, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Char, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SMTLib.SExprParser+<SkipWs>d__8, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Char, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SMTLib.SExprParser+<SkipWs>d__8, Boogie.Provers.SMTLib, Version=3.1.3.0, Culture=neutral, PublicKeyToken=null]].ExecuteFromThreadPool(System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
[1]    96793 abort      dafny46 verify w0h4.dfy

What type of operating system are you experiencing the problem on?

Mac

@hmijail hmijail added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label May 21, 2024
@keyboardDrummer
Copy link
Member

Same issue, albeit with different information: boogie-org/boogie#711

@keyboardDrummer
Copy link
Member

This issue is difficult to solve. We'll solve it at some point but I'd rather deprioritize it for now. How pressing is it for you?

@hmijail
Copy link
Author

hmijail commented May 22, 2024

Well... quite. This bug seems to lock us into using Dafny <=4.4 for a project, and unfortunately 4.4 seems to have trouble with --resource-limit and with resource usage logging (i.e., "valid" outcomes with resource count -1, either with or without isolated assertions). This kills the tools I've been building to diagnose slow/brittle verification, which is currently a huge pain point.

I'll check if earlier versions have better resource accounting.

@keyboardDrummer
Copy link
Member

Can you work around the issue by doing something like:

const TWO_8   : int := 0x1_00
const MAX_U8 : int :=  TWO_8 - 1
newtype{:nativeType "byte"} u8 = i:int    | 0 <= i <= MAX_U8
const BYTECODE_01 : seq<u8> := [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
const BYTECODE_0 : seq<u8> := BYTECODE_01 + [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

?

I can also add a hidden option to Dafny that allows customizing the used stack size, which would allow you to raise the length limit of the sequence.

@hmijail
Copy link
Author

hmijail commented May 23, 2024

That works! I don't get it. I DID try with

const BYTECODE_3 : seq<u8> := [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + 
[ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

But that causes the same stack overflow.

Happy to push forward with your version, but if there is some insight I'm missing here, I'd love to know!

@MikaelMayer MikaelMayer added the part: verifier Translation from Dafny to Boogie (translator) label May 26, 2024
@l-yc
Copy link

l-yc commented Jul 2, 2024

Dafny version

4.7

Code to produce this issue

main.dfy:

module M {
    /* Given a list of numbers, check if any two sums to 0. */
    method {:testEntry} two_sum(numbers: seq<real>) returns (b: bool)
    {
        b := false;
        var n := |numbers|;
        if n > 1 {
            var i, j := 0, 1;
            while i < n - 1
                decreases n - i
            {
                while j < n
                    decreases n - j
                {
                    var sum := numbers[j] + numbers[i];
                    if sum == 0.0 || sum == 0.0 {
                        b := true;
                        return;
                    }
                    j := j + 1;
                }
                i := i + 1;
            }
        }
    }
}

Command to run and resulting output

dafny generate-tests InlinedBlock main.dfy > main_test.dfy
dafny run main_test.dfy

What happened?

dafny generate-tests is generating a test case with a very long seq. In the code above, removing either of if n > 1 or one of the sum == 0.0 prevents this from occurring.

When main_test.dfy is executed, this issue (stackoverflow) is triggered after running for ~2-3 minutes.

What type of operating system are you experiencing the problem on?

Mac

@hmijail
Copy link
Author

hmijail commented Jul 3, 2024

Execution might be more related to compilation, and then that'd be #3759? ... or maybe all go together...?

@l-yc
Copy link

l-yc commented Jul 8, 2024

I believe verification is attempted before both execution and compilation, which seems to be the underlying cause here

@keyboardDrummer
Copy link
Member

I believe verification is attempted before both execution and compilation, which seems to be the underlying cause here

Your bug report didn't provide a stack trace, but I'm guessing you're saying the stack overflow occurs in Boogie, just like @hmijail 's, which is why you're saying this relates to verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: verifier Translation from Dafny to Boogie (translator)
Projects
None yet
Development

No branches or pull requests

4 participants