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

cce+UnreachableException in Microsoft.Dafny.Substituter.SubstStmt #2920

Closed
alex-chew opened this issue Oct 24, 2022 · 0 comments · Fixed by #2966
Closed

cce+UnreachableException in Microsoft.Dafny.Substituter.SubstStmt #2920

alex-chew opened this issue Oct 24, 2022 · 0 comments · Fixed by #2966
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: verifier Translation from Dafny to Boogie (translator)

Comments

@alex-chew
Copy link
Contributor

Verifying the following Dafny code under version nightly-2022-10-24-cd54451:

datatype D = D(x: int)

function Foo(): ()
  ensures assert true by { var D(x) := D(0); } true
{ () }

fails with the following stack trace:

Parsing <snip>/bug.dfy
Unhandled exception. System.AggregateException: One or more errors occurred. (Exception of type 'cce+UnreachableException' was thrown.)
 ---> cce+UnreachableException: Exception of type 'cce+UnreachableException' was thrown.
   at Microsoft.Dafny.Substituter.SubstStmt(Statement stmt)
   at System.Collections.Generic.List`1.ConvertAll[TOutput](Converter`2 converter)
   at Microsoft.Dafny.Substituter.SubstBlockStmt(BlockStmt stmt)
   at Microsoft.Dafny.Substituter.SubstStmt(Statement stmt)
   at Microsoft.Dafny.Substituter.Substitute(Expression expr)
   at Microsoft.Dafny.Translator.AddFunctionConsequenceAxiom(Function boogieFunction, Function f, List`1 ens)
   at Microsoft.Dafny.Translator.AddClassMember_Function(Function f)
   at Microsoft.Dafny.Translator.AddFunction_Top(Function f, Boolean includeAllMethods)
   at Microsoft.Dafny.Translator.AddClassMembers(TopLevelDeclWithMembers c, Boolean includeAllMethods, Boolean includeInformationAboutType)
   at Microsoft.Dafny.Translator.AddTypeDecl(RevealableTypeDecl d)
   at Microsoft.Dafny.Translator.DoTranslation(Program p, ModuleDefinition forModule)
   at Microsoft.Dafny.Translator.Translate(Program p, ErrorReporter reporter, TranslatorFlags flags)+MoveNext()
   at Microsoft.Dafny.DafnyDriver.Translate(ExecutionEngineOptions options, Program dafnyProgram)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Dafny.DafnyDriver.ProcessFilesAsync(IList`1 dafnyFiles, ReadOnlyCollection`1 otherFileNames, ErrorReporter reporter, Boolean lookForSnapshots, String programId)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.Dafny.DafnyDriver.ThreadMain(String[] args)
   at Microsoft.Dafny.DafnyDriver.<>c__DisplayClass10_0.<Main>b__0()
   at System.Threading.Thread.StartCallback()
Abort trap: 6

It seems important that the assert by block contains a pattern destructuring. Changing var D(x) := D(0); to var x := D(0); allows verification to pass as expected.

@alex-chew alex-chew added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: verifier Translation from Dafny to Boogie (translator) labels Oct 24, 2022
MikaelMayer added a commit that referenced this issue Nov 1, 2022
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
1 participant