Commit c0af7aa1 authored by Sergio Costas's avatar Sergio Costas

Extra test for global variables

parent cc61fa40
......@@ -958,6 +958,9 @@ class Test(unittest.TestCase):
def test228AssignGlobalVarNotNull(self):
self._generic_test("unitest/test228.c", [ (crust.crust.MSG_ERROR, "Assignment to '{:s}' at line {:d}, but it is not freed", "var1", 10) ])
def test229UseGlobalVarNotNull(self):
self._generic_test("unitest/test229.c", [ (crust.crust.MSG_ERROR, "At exit point in line {:d}, global variable '{:s}' points to a block freed at line {:d}.", 16, "var1", 11) ])
if __name__ == '__main__':
try:
os.remove("error_list.txt")
......
typedef __crust__ unsigned char *crust_t;
crust_t var1;
void function(crust_t);
void main(crust_t __crust_not_null__ arg1) {
if (var1 == NULL) {
var1 = arg1;
function(var1);
} else {
function(arg1);
}
// ERROR: there is a global variable with FREED status at exit
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment