File tree 6 files changed +37
-5
lines changed
regression/goto-instrument/stack-depth1
6 files changed +37
-5
lines changed Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --stack-depth 1
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ VERIFICATION FAILED
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ int bar (int x )
2
+ {
3
+ return 42 ;
4
+ }
5
+
6
+ int foo (int x )
7
+ {
8
+ return bar (x );
9
+ }
10
+
11
+ int main (int argc , char * argv [])
12
+ {
13
+ return foo (argc );
14
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --stack-depth 2
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ VERIFICATION SUCCESSFUL
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -1175,7 +1175,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1175
1175
status () << " Adding check for maximum call stack size" << eom;
1176
1176
stack_depth (
1177
1177
goto_model,
1178
- unsafe_string2unsigned (cmdline.get_value (" stack-depth" )));
1178
+ safe_string2size_t (cmdline.get_value (" stack-depth" )));
1179
1179
}
1180
1180
1181
1181
// ignore default/user-specified initialization of variables with static
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Date: November 2011
22
22
symbol_exprt add_stack_depth_symbol (symbol_tablet &symbol_table)
23
23
{
24
24
const irep_idt identifier=" $stack_depth" ;
25
- signedbv_typet type (sizeof (int )*8 );
25
+ unsignedbv_typet type (sizeof (std:: size_t )*8 );
26
26
27
27
symbolt new_symbol;
28
28
new_symbol.name =identifier;
@@ -43,7 +43,7 @@ symbol_exprt add_stack_depth_symbol(symbol_tablet &symbol_table)
43
43
void stack_depth (
44
44
goto_programt &goto_program,
45
45
const symbol_exprt &symbol,
46
- const int i_depth,
46
+ const std:: size_t i_depth,
47
47
const exprt &max_depth)
48
48
{
49
49
assert (!goto_program.instructions .empty ());
@@ -82,7 +82,7 @@ void stack_depth(
82
82
83
83
void stack_depth (
84
84
goto_modelt &goto_model,
85
- const int depth)
85
+ const std:: size_t depth)
86
86
{
87
87
const symbol_exprt sym=
88
88
add_stack_depth_symbol (goto_model.symbol_table );
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ Date: November 2011
14
14
#ifndef CPROVER_GOTO_INSTRUMENT_STACK_DEPTH_H
15
15
#define CPROVER_GOTO_INSTRUMENT_STACK_DEPTH_H
16
16
17
+ #include < cstddef>
18
+
17
19
class goto_modelt ;
18
20
19
21
void stack_depth (
20
22
goto_modelt &,
21
- const int depth);
23
+ const std:: size_t depth);
22
24
23
25
#endif // CPROVER_GOTO_INSTRUMENT_STACK_DEPTH_H
You can’t perform that action at this time.
0 commit comments