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

Missing type conversion yields constraint error #902

Closed
senier opened this issue Jan 13, 2022 · 0 comments · Fixed by #906
Closed

Missing type conversion yields constraint error #902

senier opened this issue Jan 13, 2022 · 0 comments · Fixed by #906
Assignees
Labels
bug generator Related to generator package (SPARK code generation)

Comments

@senier
Copy link
Member

senier commented Jan 13, 2022

package Test is

   type Length is mod 2 ** 8;
   type Elems is range 0 .. 1 with Size => 8;

   type Data is
      message
         Length : Length;
         Value  : Opaque
            with Size => 8 * Length;
      end message;

   type Message (L : Length) is
      message
         Elems : Elems;
         Data  : Opaque
            with Size => 8 * L * Elems;
      end message;

   generic
   session S with
      Initial => Init,
      Final   => Done
   is
      M : Message;
      D : Data;
      E : Elems;
   begin
      state Init
      is
      begin
         M := Message'(L     => 64,
                       Elems => E,
                       Data  => D.Value);
      transition
         goto Done
      exception
         goto Done
      end Init;

      state Done is null state;
   end S;

end Test;
gprbuild -P build
Compile
   [Ada]          rflx-rflx_builtin_types-conversions.ads
   [Ada]          rflx-test-s_allocator.adb
   [Ada]          rflx-test-s.adb
rflx-test-s.adb:27:147: error: value not in range of type "Elems" defined at rflx-test.ads:44
rflx-test-s.adb:27:147: error: static expression fails Constraint_Check
rflx-test-s.adb:28:169: error: value not in range of type "Elems" defined at rflx-test.ads:44
rflx-test-s.adb:28:169: error: static expression fails Constraint_Check
gprbuild: *** compilation phase failed
make: *** [Makefile:5: all] Error 4
@senier senier created this issue from a note in RecordFlux 0.6 (To do) Jan 13, 2022
@senier senier added bug generator Related to generator package (SPARK code generation) labels Jan 13, 2022
@treiher treiher self-assigned this Jan 13, 2022
@treiher treiher moved this from To do to Implementation in RecordFlux 0.6 Jan 13, 2022
treiher added a commit that referenced this issue Jan 14, 2022
@treiher treiher moved this from Implementation to Review in RecordFlux 0.6 Jan 14, 2022
RecordFlux 0.6 automation moved this from Review to Done Jan 14, 2022
treiher added a commit that referenced this issue Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug generator Related to generator package (SPARK code generation)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants