Assignment after break in match causes crash error #4894
Labels
crash
Dafny crashes on this input, or generates malformed code that can not be executed
during 2: compilation of correct program
Dafny rejects a valid program during compilation
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
priority: next
Will consider working on this after in progress work is done
Dafny version
4.1.0.0
Code to produce this issue
Command to run and resulting output
What happened?
Compiling the program with the compiler caused a crash error.
Full error message
Unhandled exception. System.AggregateException: One or more errors occurred. (Value cannot be null. (Parameter 'key'))
---> System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary
2.FindValue(TKey key) at System.Collections.Generic.Dictionary
2.TryGetValue(TKey key, TValue& value)at Microsoft.Dafny.BoogieGenerator.CheckDefiniteAssignment(IdentifierExpr expr, BoogieStmtListBuilder builder) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.DefiniteAssignment.cs:line 165
at Microsoft.Dafny.BoogieGenerator.CheckWellformedWithResult(Expression expr, WFOptions wfOptions, Expr result, Type resultType, List
1 locals, BoogieStmtListBuilder builder, ExpressionTranslator etran, String resultDescription) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.ExpressionWellformed.cs:line 300 at Microsoft.Dafny.BoogieGenerator.CheckWellformedWithResult(Expression expr, WFOptions wfOptions, Expr result, Type resultType, List
1 locals, BoogieStmtListBuilder builder, ExpressionTranslator etran, String resultDescription) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.ExpressionWellformed.cs:line 1210at Microsoft.Dafny.BoogieGenerator.CheckWellformed(Expression expr, WFOptions options, List
1 locals, BoogieStmtListBuilder builder, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.ExpressionWellformed.cs:line 254 at Microsoft.Dafny.BoogieGenerator.TrStmt_CheckWellformed(Expression expr, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran, Boolean subsumption, Boolean lValueContext) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2818at Microsoft.Dafny.BoogieGenerator.TrAssignmentRhs(IToken tok, IdentifierExpr bGivenLhs, IVariable lhsVar, Type lhsType, AssignmentRhs rhs, Type rhsTypeConstraint, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran, Statement stmt) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2580 at Microsoft.Dafny.BoogieGenerator.ProcessRhss(List
1 lhsBuilder, List1 bLhss, List
1 lhss, List1 rhss, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran, Statement stmt) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2232at Microsoft.Dafny.BoogieGenerator.TrAssignment(Statement stmt, Expression lhs, AssignmentRhs rhs, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 1147 at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 256at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 221 at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 484at Microsoft.Dafny.BoogieGenerator.TrStmtList(List
1 stmts, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2786at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 305 at Microsoft.Dafny.BoogieGenerator.TrStmtList(List
1 stmts, BoogieStmtListBuilder builder, List1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2786 at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 305at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 431 at Microsoft.Dafny.BoogieGenerator.TrStmtList(List
1 stmts, BoogieStmtListBuilder builder, List1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2786 at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 305at Microsoft.Dafny.BoogieGenerator.<>c__DisplayClass436_0.b__0(BoogieStmtListBuilder bld, ExpressionTranslator e) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 993
at Microsoft.Dafny.BoogieGenerator.TrLoop(LoopStmt s, Expression Guard, BodyTranslator bodyTr, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran, Expr freeInvariant, Boolean includeTerminationCheck) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 1551 at Microsoft.Dafny.BoogieGenerator.TrWhileStmt(WhileStmt stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 998at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 318 at Microsoft.Dafny.BoogieGenerator.TrStmtList(List
1 stmts, BoogieStmtListBuilder builder, List1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 2786 at Microsoft.Dafny.BoogieGenerator.TrStmt(Statement stmt, BoogieStmtListBuilder builder, List
1 locals, ExpressionTranslator etran) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs:line 305at Microsoft.Dafny.BoogieGenerator.AddMethodImpl(Method m, Procedure proc, Boolean wellformednessProc) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.Methods.cs:line 667
at Microsoft.Dafny.BoogieGenerator.AddMethod_Top(Method m, Boolean isByMethod, Boolean includeAllMethods) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.Methods.cs:line 209
at Microsoft.Dafny.BoogieGenerator.AddClassMembers(TopLevelDeclWithMembers c, Boolean includeAllMethods, Boolean includeInformationAboutType) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.Methods.cs:line 79
at Microsoft.Dafny.BoogieGenerator.AddRevealableTypeDecl(RevealableTypeDecl d) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.Types.cs:line 879
at Microsoft.Dafny.BoogieGenerator.DoTranslation(Program p, ModuleDefinition forModule) in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.cs:line 821
at Microsoft.Dafny.BoogieGenerator.Translate(Program p, ErrorReporter reporter, TranslatorFlags flags)+MoveNext() in /home/dilan/dafny/Source/DafnyCore/Verifier/BoogieGenerator.cs:line 893
at Microsoft.Dafny.CompilerDriver.Translate(ExecutionEngineOptions options, Program dafnyProgram)+MoveNext() in /home/dilan/dafny/Source/DafnyDriver/CompilerDriver.cs:line 224
at System.Collections.Generic.List
1..ctor(IEnumerable
1 collection)at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source) at Microsoft.Dafny.CompilerDriver.<>c__DisplayClass4_0.<ProcessFilesAsync>b__0() in /home/dilan/dafny/Source/DafnyDriver/CompilerDriver.cs:line 153 at System.Threading.Tasks.Task
1.InnerInvoke()at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.Dafny.CompilerDriver.ProcessFilesAsync(IReadOnlyList
1 dafnyFiles, ReadOnlyCollection
1 otherFileNames, DafnyOptions options, ProofDependencyManager depManager, Boolean lookForSnapshots, String programId) in /home/dilan/dafny/Source/DafnyDriver/CompilerDriver.cs:line 152at Microsoft.Dafny.CompilerDriver.RunCompiler(DafnyOptions options) in /home/dilan/dafny/Source/DafnyDriver/CompilerDriver.cs:line 68
at Microsoft.Dafny.DafnyCli.<>c.<b__4_0>d.MoveNext() in /home/dilan/dafny/Source/DafnyDriver/Commands/DafnyCli.cs:line 59
--- End of stack trace from previous location ---
at Microsoft.Dafny.DafnyCli.Execute(TextWriter outputWriter, TextWriter errorWriter, TextReader inputReader, String[] arguments, Func
2 onLegacyArguments) in /home/dilan/dafny/Source/DafnyDriver/Commands/DafnyCli.cs:line 216 --- End of inner exception stack trace --- at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification)at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.Dafny.DafnyCli.MainWithWriters(TextWriter outputWriter, TextWriter errorWriter, TextReader inputReader, String[] args) in /home/dilan/dafny/Source/DafnyDriver/Commands/DafnyCli.cs:line 47
at Microsoft.Dafny.DafnyCli.Main(String[] args) in /home/dilan/dafny/Source/DafnyDriver/Commands/DafnyCli.cs:line 35
at Dafny.Dafny.Main(String[] args) in /home/dilan/dafny/Source/Dafny/Dafny.cs:line 7
What type of operating system are you experiencing the problem on?
Linux
The text was updated successfully, but these errors were encountered: