Skip to content

Commit ef577ad

Browse files
committed
Add failing test as Size representation fails when applied to
derivations of existing types or to object declarations. Assertion: pragma Assert (Entity_Esize = UI_From_Int (Int (Get_Width (Target_Type_Irep))) and Entity_Esize = Expression_Value); fails in procedure Handle_Representation_Claise
1 parent 4033a5a commit ef577ad

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
procedure Check_Size is
2+
Size_1 : constant := -23 + 31;
3+
Size_2 : constant Integer := 35 - 3;
4+
Size_3 : constant := 2 * Size_1;
5+
6+
type T_1 is new Integer range 0 .. 47;
7+
for T_1'Size use Size_1;
8+
9+
type T_2 is range 0 .. 2**16 + 1;
10+
for T_2'Size use Size_2;
11+
12+
type Unsigned_8 is mod 2**8;
13+
for Unsigned_8'Size use Size_3;
14+
15+
Var_T_1 : T_1;
16+
Var_T_2 : T_2;
17+
18+
Var_Size_1 : Integer range 0 .. 47;
19+
for Var_Size_1'Size use Size_1;
20+
21+
Var_Size_2 : Integer range 0 .. 2**16 + 1;
22+
for Var_Size_2'Size use Size_2;
23+
24+
Var_U8 : Unsigned_8;
25+
for Var_U8'Size use Size_1;
26+
27+
begin
28+
Var_T_1 := 30;
29+
Var_T_2 := 40;
30+
pragma Assert (Integer (Var_T_1) + Integer (Var_T_2) = 70);
31+
32+
Var_Size_1 := 10;
33+
Var_Size_2 := 20;
34+
pragma Assert (Var_Size_1 + Var_Size_2 = 30);
35+
36+
Var_U8 := 255;
37+
pragma Assert (Var_U8 + 1 = 0);
38+
end Check_Size;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
+===========================GNAT BUG DETECTED==============================+
2+
| GNU Ada (ada2goto) Assert_Failure tree_walk.adb:4673 |
3+
| Error detected at check_size.adb:1:11 |
4+
| Please submit a bug report; see https://gcc.gnu.org/bugs/ . |
5+
| Use a subject line meaningful to you and us to track the bug. |
6+
| Include the entire contents of this bug box in the report. |
7+
| Include the exact command that you entered. |
8+
| Also include sources listed below. |
9+
+==========================================================================+
10+
11+
Please include these source files with error report
12+
Note that list may not be accurate in some cases,
13+
so please double check that the problem can still
14+
be reproduced with the set of files listed.
15+
Consider also -gnatd.n switch (see debug.adb).
16+
17+
check_size.adb
18+
19+
compilation abandoned
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from test_support import *
2+
3+
prove()

0 commit comments

Comments
 (0)