Skip to content

Range checks for subtypes not supported correctly. #226

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

Open
NlightNFotis opened this issue May 15, 2019 · 0 comments
Open

Range checks for subtypes not supported correctly. #226

NlightNFotis opened this issue May 15, 2019 · 0 comments

Comments

@NlightNFotis
Copy link
Contributor

This has been a problem that I discovered while working on supporting subtypes within enumeration symbols.

For example, this code is failing:

procedure Range_Second is
  type Indicator_Type is (
    CALIBRATION_MODE,
    MEASUREMENT_MODE,
    CALIBRATION_PASS,
    CALIBRATION_FAIL,
    MEASUREMENT_NOT_PROVEN,
    MEASUREMENT_PRESENT);

  subtype Result_Indicator_Type is Indicator_Type range CALIBRATION_PASS .. MEASUREMENT_NOT_PROVEN;

  procedure Testable (Result : Result_Indicator_Type) is
  begin
    null;
  end Testable;

begin
  Testable (CALIBRATION_PASS);
  Testable (MEASUREMENT_PRESENT);
end Range_Second;

But the problem is not necessarily on the symbols signifying the range, as the same program with integer ranges is also failing the range checks.

procedure Range_Second is
  type An_Int is range 1..1000;
  subtype Another_Int is An_Int range 5..100;

  procedure Testable (Result : Another_Int) is
  begin
    null;
  end Testable;

begin
  Testable (50);
  Testable (200);
end Range_Second;

Failing the range checks in this case means that CBMC returns VERIFICATION SUCCESSFUL when otherwise it should have assertion failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant