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

Base type overflows integer range #205

Closed
senier opened this issue Apr 15, 2020 · 4 comments · Fixed by #294
Closed

Base type overflows integer range #205

senier opened this issue Apr 15, 2020 · 4 comments · Fixed by #294
Assignees
Labels
bug generator Related to generator package (SPARK code generation)

Comments

@senier
Copy link
Member

senier commented Apr 15, 2020

The following spec

package Foo is
   type Len is range 1 .. 16 with Size => 64;
   type Req is
       message
           Len : Len;
       end message;
end Foo;

fails to compile:

rflx-foo.ads:13:21: integer type definition bounds out of range

The reason is that the base type for Len is generated such that the constant for the upper range exceeds 2**64-1:

type Len_Base is range 0 .. 2**64 - 1 with Size => 64; 

Could we use a non-wrapping modular type as base type to simplify the issue?

@senier senier created this issue from a note in RecordFlux 0.4 (To do) Apr 15, 2020
@treiher
Copy link
Collaborator

treiher commented Apr 15, 2020

I was not aware that a non-wrapping modular type in Ada exists. Is there an aspect for this purpose?

@senier
Copy link
Member Author

senier commented Apr 15, 2020

Yes, I just have to look up its name every single time. It's a gnatprove annotation called No_Wrap_Around. See the docs for details.

@treiher
Copy link
Collaborator

treiher commented Apr 15, 2020

Using a non-wrapping modular type seems to solve this issue, but leads to the issue seen in #182. So we have to fix #182 first.

@senier
Copy link
Member Author

senier commented Apr 15, 2020

Thanks for trying. Yes, I was expecting #182 to be an issue her, too. In that ticket I already hypothesized that No_Wrap_Around may also be helpful.

@senier senier added this to To do in RecordFlux 0.5 via automation May 11, 2020
@senier senier removed this from To do in RecordFlux 0.4 May 11, 2020
@senier senier added the bug label May 14, 2020
@senier senier added this to To do in RecordFlux 0.4 via automation May 14, 2020
@senier senier removed this from To do in RecordFlux 0.5 May 14, 2020
@treiher treiher added the generator Related to generator package (SPARK code generation) label May 14, 2020
@treiher treiher self-assigned this May 20, 2020
@treiher treiher moved this from To do to In progress in RecordFlux 0.4 May 20, 2020
@senier senier added this to To do in RecordFlux 0.5 via automation May 27, 2020
@senier senier removed this from In progress in RecordFlux 0.4 May 27, 2020
@treiher treiher moved this from To do to In progress in RecordFlux 0.5 Jun 3, 2020
@senier senier added this to To do in RecordFlux 0.4.1 via automation Jun 6, 2020
@senier senier removed this from In progress in RecordFlux 0.5 Jun 6, 2020
@senier senier moved this from To do to In progress in RecordFlux 0.4.1 Jun 6, 2020
treiher added a commit that referenced this issue Jun 17, 2020
treiher added a commit that referenced this issue Jun 17, 2020
treiher added a commit that referenced this issue Jun 17, 2020
treiher added a commit that referenced this issue Jun 17, 2020
treiher added a commit that referenced this issue Jun 17, 2020
treiher added a commit that referenced this issue Jun 19, 2020
treiher added a commit that referenced this issue Jun 19, 2020
treiher added a commit that referenced this issue Jun 22, 2020
treiher added a commit that referenced this issue Jun 22, 2020
RecordFlux 0.4.1 automation moved this from In progress to Done Jun 22, 2020
treiher added a commit that referenced this issue Jun 22, 2020
treiher added a commit that referenced this issue Jun 22, 2020
treiher added a commit that referenced this issue Jul 23, 2020
treiher added a commit that referenced this issue Jul 23, 2020
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