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

NullReferenceException crash in ErrorReporter.Error due to Resolver.CheckIsLvalue #2496

Closed
cpitclaudel opened this issue Jul 27, 2022 · 0 comments · Fixed by #2978
Closed
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking

Comments

@cpitclaudel
Copy link
Member

Input:

method M() {
  b1 :| true;
}

Output:

 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dafny.ErrorReporter.Error(MessageSource source, Expression e, String msg, Object[] args) in C:\build\Source\Dafny\Reporting.cs:line 95
   at Microsoft.Dafny.Resolver.CheckIsLvalue(Expression lhs, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 13582
   at Microsoft.Dafny.Resolver.ResolveAssignSuchThatStmt(AssignSuchThatStmt s, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 13092
   at Microsoft.Dafny.Resolver.ResolveConcreteUpdateStmt(ConcreteUpdateStatement s, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 12973
   at Microsoft.Dafny.Resolver.ResolveStatement(Statement stmt, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 11174
   at Microsoft.Dafny.Resolver.ResolveStatementWithLabels(Statement stmt, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 13635
   at Microsoft.Dafny.Resolver.ResolveBlockStatement(BlockStmt blockStmt, ICodeContext codeContext) in C:\build\Source\Dafny\Resolver.cs:line 13605
   at Microsoft.Dafny.Resolver.ResolveMethod(Method m) in C:\build\Source\Dafny\Resolver.cs:line 10400
   at Microsoft.Dafny.Resolver.ResolveClassMemberBodies(TopLevelDeclWithMembers cl) in C:\build\Source\Dafny\Resolver.cs:line 9613
   at Microsoft.Dafny.Resolver.ResolveTopLevelDecls_Core(List`1 declarations, Graph`1 datatypeDependencies, Graph`1 codatatypeDependencies, Boolean isAnExport) in C:\build\Source\Dafny\Resolver.cs:line 2821
   at Microsoft.Dafny.Resolver.ResolveModuleDefinition(ModuleDefinition m, ModuleSignature sig, Boolean isAnExport) in C:\build\Source\Dafny\Resolver.cs:line 1035
   at Microsoft.Dafny.Resolver.ResolveProgram(Program prog) in C:\build\Source\Dafny\Resolver.cs:line 507
   at Microsoft.Dafny.Main.Resolve(Program program, ErrorReporter reporter) in C:\build\Source\Dafny\DafnyMain.cs:line 163
   at Microsoft.Dafny.Main.ParseCheck(IList`1 files, String programName, ErrorReporter reporter, Program& program) in C:\build\Source\Dafny\DafnyMain.cs:line 114
   at Microsoft.Dafny.DafnyDriver.ProcessFiles(IList`1 dafnyFiles, ReadOnlyCollection`1 otherFileNames, ErrorReporter reporter, Boolean lookForSnapshots, String programId) in C:\build\Source\DafnyDriver\DafnyDriver.cs:line 301
   --- 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) in C:\build\Source\DafnyDriver\DafnyDriver.cs:line 116
   at Microsoft.Dafny.DafnyDriver.<>c__DisplayClass9_0.<Main>b__0() in C:\build\Source\DafnyDriver\DafnyDriver.cs:line 92
   at System.Threading.Thread.StartCallback()
@cpitclaudel cpitclaudel added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking crash Dafny crashes on this input, or generates malformed code that can not be executed labels Jul 27, 2022
MikaelMayer added a commit that referenced this issue Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Dafny crashes on this input, or generates malformed code that can not be executed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant