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

Include directives can lead to including unverified code in doo files #4762

Open
robin-aws opened this issue Nov 9, 2023 · 1 comment · May be fixed by #5406 or #5170
Open

Include directives can lead to including unverified code in doo files #4762

robin-aws opened this issue Nov 9, 2023 · 1 comment · May be fixed by #5406 or #5170
Assignees
Labels
during 3: execution of incorrect program An bug in the verifier that allows Dafny to run a program that does not correctly implement its spec part: tools Tools built on top of Dafny

Comments

@robin-aws
Copy link
Member

// Unverified.dfy
module Library {
  method Kaboom() {
    print 1/0;
  }
}
// Verified.dfy
include "Unverified.dfy"

module Consumer {

  import Library

  method Main() {
    Library.Kaboom();
  }
}
% dafny build -t:lib Unverified.dfy 
Unverified.dfy(3,10): Error: possible division by zero
  |
3 |     print 1/0;
  |            ^^
% dafny build -t:lib Verified.dfy

Dafny program verifier finished with 1 verified, 0 errors
% dafny run Verified.doo

Dafny program verifier finished with 0 verified, 0 errors
Unhandled exception. System.DivideByZeroException: Attempted to divide by zero.
  ...

This is arguably the documented behavior since included files are not verified by default, but given .doo files are intended to be the safest way to allow skipping verification later on, I say they should not include the source of unverified files.

@robin-aws robin-aws added part: tools Tools built on top of Dafny during 3: execution of incorrect program An bug in the verifier that allows Dafny to run a program that does not correctly implement its spec labels Nov 9, 2023
@robin-aws robin-aws self-assigned this Nov 9, 2023
@keyboardDrummer
Copy link
Member

I suggest we fix the problem by using OptionCompatibility.CheckOptionLocalImpliesLibrary for VerifyIncludedFiles and changing the default for VerifyIncludedFiles to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
during 3: execution of incorrect program An bug in the verifier that allows Dafny to run a program that does not correctly implement its spec part: tools Tools built on top of Dafny
Projects
None yet
2 participants