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

Verification of size aspects with Message'Last #627

Closed
jklmnn opened this issue Mar 31, 2021 · 3 comments · Fixed by #889
Closed

Verification of size aspects with Message'Last #627

jklmnn opened this issue Mar 31, 2021 · 3 comments · Fixed by #889
Assignees
Labels
bug model Related to model package (e.g., model verification)

Comments

@jklmnn
Copy link
Member

jklmnn commented Mar 31, 2021

I checked the flexibility of the shortcut syntax for size aspects and noticed that it is possible to create messages with overlapping fields:

package P1 is

   type Kind is mod 2**16;

   type Frame is
      message
         Kind : Kind
            then Payload
                if Kind = 1
            then Kind2
                if Kind = 2;
         Kind2 : Kind;
         Payload : Opaque
            with Size => Message'Last - Kind'Last;
      end message;

end P1;

In this case Payload always ranges from Kind to the end of the message. If Kind = 2 then Kind2 will be overwritten by payload. This spec is not rejected.

@jklmnn jklmnn created this issue from a note in RecordFlux 0.5 (To do) Mar 31, 2021
@jklmnn jklmnn added bug model Related to model package (e.g., model verification) labels Mar 31, 2021
@treiher
Copy link
Collaborator

treiher commented Mar 31, 2021

That is not related to the shortcut syntax. The semantically equivalent specification is also accepted:

package Test is

   type Kind is mod 2**16;

   type Frame is
      message
         Kind : Kind
            then Payload
               with Size => Message'Last - Kind'Last
               if Kind = 1
            then Kind2
               if Kind = 2;
         Kind2 : Kind
            then Payload
               with Size => Message'Last - Kind'Last;
         Payload : Opaque;
      end message;

end Test;

@treiher treiher changed the title Overlapping fields are not detected with shortcut syntax for size aspect Verification of size aspects with Message'Last Mar 31, 2021
@treiher
Copy link
Collaborator

treiher commented Mar 31, 2021

This specification should also not be accepted:

package Test is

   type Kind is mod 2**16;

   type Frame is
      message
         Kind : Kind
            then Payload
               with Size => Message'Last - Kind'Last
               if Kind = 1
            then Kind2
               if Kind = 2;
         Kind2 : Kind
            then Payload
               with Size => Message'Last + 128;
         Payload : Opaque;
      end message;

end Test;

@treiher treiher removed this from To do in RecordFlux 0.5 Mar 31, 2021
@treiher treiher added this to To do in RecordFlux 0.7 via automation Mar 31, 2021
@senier senier removed this from To do in RecordFlux 0.7 Jul 26, 2021
@senier senier added this to To do in RecordFlux 0.6 via automation Jul 26, 2021
@senier
Copy link
Member

senier commented Oct 12, 2021

This will be obsolete once #736 is implemented.

@treiher treiher moved this from To do to Implementation in RecordFlux 0.6 Dec 14, 2021
@treiher treiher self-assigned this Dec 14, 2021
treiher added a commit that referenced this issue Dec 14, 2021
treiher added a commit that referenced this issue Dec 16, 2021
treiher added a commit that referenced this issue Dec 17, 2021
treiher added a commit that referenced this issue Dec 20, 2021
treiher added a commit that referenced this issue Dec 21, 2021
treiher added a commit that referenced this issue Dec 21, 2021
@senier senier moved this from Implementation to Review in RecordFlux 0.6 Dec 21, 2021
RecordFlux 0.6 automation moved this from Review to Done Jan 3, 2022
treiher added a commit that referenced this issue Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug model Related to model package (e.g., model verification)
Projects
No open projects
3 participants