File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
regression/goto-instrument/uninitialized-check Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdlib.h>
2
+
3
+ int globals_are_actually_initialized ; // See ISO-9899!
4
+
5
+ int main (int argc , char * * argv )
6
+ {
7
+ int definitely_uninitialized ;
8
+ int maybe_uninitialized ;
9
+ int actually_initialized ;
10
+
11
+ if (argc > 1 )
12
+ {
13
+ maybe_uninitialized = 1 ;
14
+ }
15
+
16
+ if (argc <= 3 )
17
+ {
18
+ actually_initialized = 0 ;
19
+ }
20
+ if (argc >= 4 )
21
+ {
22
+ actually_initialized = 1 ;
23
+ }
24
+
25
+ int * heap_variables_uninitialized = malloc (sizeof (int ));
26
+
27
+ return definitely_uninitialized + maybe_uninitialized + actually_initialized +
28
+ globals_are_actually_initialized + * heap_variables_uninitialized ;
29
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --uninitialized-check
4
+ ^\[main.uninitialized_local.1\] line \d+ use of uninitialized local variable main::1::definitely_uninitialized: FAILURE$
5
+ ^\[main.uninitialized_local.2\] line \d+ use of uninitialized local variable main::1::maybe_uninitialized: FAILURE$
6
+ ^\[main.uninitialized_local.3\] line \d+ use of uninitialized local variable main::1::actually_initialized: SUCCESS$
7
+ ^VERIFICATION FAILED$
8
+ ^EXIT=10$
9
+ ^SIGNAL=0$
10
+ --
11
+ ^warning: ignoring
12
+ --
13
+ A basic test of the uninitialized variable check.
14
+ In an ideal world there would be a check for heap_variables_uninitialized
15
+ that would fail however this is beyond the current scope of the analysis.
16
+
You can’t perform that action at this time.
0 commit comments