Skip to content

Commit de356ef

Browse files
Merge pull request #261 from tjj2017/char_subtype
Add a failing test for a character subtype
2 parents fb2e038 + 75a1a5e commit de356ef

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
procedure Char_Subtype is
2+
subtype Capitals is Character range 'A' .. 'Z';
3+
4+
Var_C : Capitals;
5+
begin
6+
Var_C := 'C';
7+
pragma Assert (Var_C in Capitals);
8+
end Char_Subtype;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALL XFAIL gnat2goto reports invalid range types and cbmc fails with an invariant violation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Standard_Output from gnat2goto char_subtype:
2+
N_Character_Literal "QU41" (Node_Id=2264) (source,analyzed)
3+
Parent = N_Range (Node_Id=2265)
4+
Sloc = 12353 char_subtype.adb:2:40
5+
Chars = "QU41" (Name_Id=300001450)
6+
Is_Static_Expression = True
7+
Etype = N_Defining_Identifier "character" (Entity_Id=100s)
8+
Char_Literal_Value = 65 (Uint = 600032833)
9+
N_Character_Literal "QU5a" (Node_Id=2266) (source,analyzed)
10+
Parent = N_Range (Node_Id=2265)
11+
Sloc = 12360 char_subtype.adb:2:47
12+
Chars = "QU5a" (Name_Id=300001451)
13+
Is_Static_Expression = True
14+
Etype = N_Defining_Identifier "character" (Entity_Id=100s)
15+
Char_Literal_Value = 90 (Uint = 600032858)
16+
N_In (Node_Id=2286) (source,analyzed)
17+
Parent = N_Pragma_Argument_Association <No_Name> (Node_Id=2290)
18+
Sloc = 12434 char_subtype.adb:7:25
19+
Left_Opnd = N_Identifier "var_c" (Node_Id=2283)
20+
Right_Opnd = N_Identifier "capitals" (Node_Id=2285)
21+
Etype = N_Defining_Identifier "boolean" (Entity_Id=16s)
22+
23+
Standard_Error from gnat2goto char_subtype:
24+
----------At: Do_Base_Range_Constraint----------
25+
----------unsupported lower range kind----------
26+
----------At: Do_Base_Range_Constraint----------
27+
----------unsupported upper range kind----------
28+
----------At: Do_Expression----------
29+
----------In----------
30+
31+
Error from cbmc char_subtype:
32+
--- begin invariant violation report ---
33+
Invariant check failed
34+
File: symex_assign.cpp:35 function: symex_assign
35+
Condition: lhs.type() == rhs.type()
36+
Reason: assignments must be type consistent
37+
Backtrace:
38+
0 cbmc 0x0000000108a5edba _Z15print_backtraceRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEE + 74
39+
1 cbmc 0x0000000108a5f38c _Z13get_backtracev + 252
40+
2 cbmc 0x000000010880b6ac _Z29invariant_violated_structuredI17invariant_failedtJRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_9enable_ifIXsr3std10is_base_ofIS0_T_EE5valueEvE4typeES9_S9_iS9_DpOT0_ + 44
41+
3 cbmc 0x00000001087cf784 _ZN11goto_symext12symex_assignER17goto_symex_statetRK12code_assignt + 1236
42+
4 cbmc 0x00000001087f0e6e _ZN11goto_symext24execute_next_instructionERKNSt3__18functionIFRK14goto_functiontRK8dstringtEEER17goto_symex_statet + 718
43+
5 cbmc 0x00000001087f0b2a _ZN11goto_symext10symex_stepERKNSt3__18functionIFRK14goto_functiontRK8dstringtEEER17goto_symex_statet + 42
44+
6 cbmc 0x00000001086db94c _ZN10symex_bmct10symex_stepERKNSt3__18functionIFRK14goto_functiontRK8dstringtEEER17goto_symex_statet + 588
45+
7 cbmc 0x00000001087ee80d _ZN11goto_symext19symex_threaded_stepER17goto_symex_statetRKNSt3__18functionIFRK14goto_functiontRK8dstringtEEE + 29
46+
8 cbmc 0x00000001087eeb3f _ZN11goto_symext16symex_with_stateER17goto_symex_statetRKNSt3__18functionIFRK14goto_functiontRK8dstringtEEER13symbol_tablet + 191
47+
9 cbmc 0x00000001087efadd _ZN11goto_symext25symex_from_entry_point_ofERKNSt3__18functionIFRK14goto_functiontRK8dstringtEEER13symbol_tablet + 61
48+
10 cbmc 0x00000001086c69ea _ZN30multi_path_symex_only_checkert17generate_equationEv + 74
49+
11 cbmc 0x00000001086c5303 _ZN25multi_path_symex_checkertclERNSt3__113unordered_mapI8dstringt14property_infotNS0_4hashIS2_EENS0_8equal_toIS2_EENS0_9allocatorINS0_4pairIKS2_S3_EEEEEE + 83
50+
12 cbmc 0x0000000108ae8e64 _ZN43all_properties_verifier_with_trace_storagetI25multi_path_symex_checkertEclEv + 52
51+
13 cbmc 0x0000000108ae176d _ZN19cbmc_parse_optionst4doitEv + 4125
52+
14 cbmc 0x0000000108a77619 _ZN19parse_options_baset4mainEv + 249
53+
15 cbmc 0x0000000108add09d main + 45
54+
16 libdyld.dylib 0x00007fff7c363015 start + 1
55+
56+
57+
--- end invariant violation report ---
58+
59+
ERROR code -6 returned by cbmc when processing char_subtype
60+
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)