diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-21 22:33:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-21 22:33:31 +0300 |
commit | ea01f27cb708bec294b979eec5c9c5a2c81a6cd3 (patch) | |
tree | 5d844928e54fcd8afc8f7679c718f34c4d4bdf4b | |
parent | ede2fa9af29acd6cb35c8dce89f1958e5feae139 (diff) | |
download | paranucker-ea01f27cb708bec294b979eec5c9c5a2c81a6cd3.tar.gz paranucker-ea01f27cb708bec294b979eec5c9c5a2c81a6cd3.tar.bz2 paranucker-ea01f27cb708bec294b979eec5c9c5a2c81a6cd3.tar.xz paranucker-ea01f27cb708bec294b979eec5c9c5a2c81a6cd3.zip |
Add test 17.
-rw-r--r-- | test/Makefile | 13 | ||||
-rw-r--r-- | test/test17-01.txt | 509 | ||||
-rw-r--r-- | test/test17-02.txt | 13 | ||||
-rw-r--r-- | test/test17-03.txt | 227 | ||||
-rw-r--r-- | test/test17-04.txt | 15 | ||||
-rw-r--r-- | test/test17.c | 52 |
6 files changed, 828 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile index 547498c..ce81ac9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -15,7 +15,8 @@ TESTS13 = test13-01 test13-02 test13-03 test13-04 test13-05 TESTS14 = test14-01 test14-02 test14-03 test14-04 TESTS15 = test15-01 test15-02 test15-03 test15-04 TESTS16 = test16-01 test16-02 test16-03 test16-04 -ALLTESTS = test01 test02 test03 test04 test05 test06 test07 test08 test09 test10 test11 test12 test13 test14 test15 test16 ${TESTS01} ${TESTS02} ${TESTS03} ${TESTS04} ${TESTS05} ${TESTS06} ${TESTS07} ${TESTS08} ${TESTS09} ${TESTS10} ${TESTS11} ${TESTS12} ${TESTS13} ${TESTS14} ${TESTS15} ${TESTS16} +TESTS17 = test17-01 test17-02 test17-03 test17-04 +ALLTESTS = test01 test02 test03 test04 test05 test06 test07 test08 test09 test10 test11 test12 test13 test14 test15 test16 test17 ${TESTS01} ${TESTS02} ${TESTS03} ${TESTS04} ${TESTS05} ${TESTS06} ${TESTS07} ${TESTS08} ${TESTS09} ${TESTS10} ${TESTS11} ${TESTS12} ${TESTS13} ${TESTS14} ${TESTS15} ${TESTS16} ${TESTS17} .PHONY: ${ALLTESTS} ${CRASHES} all crashes @@ -189,6 +190,16 @@ test16-03: test16-04: $(call CMD,detectnullpointers,test16.c,test16-04.txt) +test17: ${TESTS17} +test17-01: + $(call CMD,dump,test17.c,test17-01.txt) +test17-02: + $(call CMD,findargs,test17.c,test17-02.txt) +test17-03: + $(call CMD,dumpnullpointers,test17.c,test17-03.txt) +test17-04: + $(call CMD,detectnullpointers,test17.c,test17-04.txt) + crashtest01: $(call CMDXX,dump,crashtest01.h,crashtest01-01.txt) crashtest02: diff --git a/test/test17-01.txt b/test/test17-01.txt new file mode 100644 index 0000000..578aec0 --- /dev/null +++ b/test/test17-01.txt @@ -0,0 +1,509 @@ +function_decl func1 test17.c 8:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + tree_list - arg types + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + void_type - value + type_decl void - type name + result_decl test17.c 8:5 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + - isUsed: 1 + parm_decl ptr1 test17.c 8:25 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + parm_decl ptr2 test17.c 8:45 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + bind_expr test17.c 9:1 - code + statement_list - operand + cond_expr test17.c 10:8 - statement + eq_expr test17.c 10:9 - operand + - isUsed: 1 + parm_decl ptr1 test17.c 8:25 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 11:15 - operand + modify_expr test17.c 11:15 - operand + result_decl test17.c 8:5 - operand + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + integer_cst 0 - operand + modify_expr test17.c 13:15 - statement + component_ref test17.c 13:9 - operand + indirect_ref test17.c 13:9 - object + - isUsed: 1 + parm_decl ptr1 test17.c 8:25 - ref + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + block - operand +test17.c: In function 'func2': +test17.c:18:14: warning: comparison between pointer and integer + if (ptr1 == (123, 0)) + ^ +function_decl func2 test17.c 16:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + tree_list - arg types + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + void_type - value + type_decl void - type name + result_decl test17.c 16:5 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + - isUsed: 1 + parm_decl ptr1 test17.c 16:25 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + parm_decl ptr2 test17.c 16:45 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + bind_expr test17.c 17:1 - code + statement_list - operand + cond_expr test17.c 18:8 - statement + compound_expr test17.c 18:14 - operand + integer_cst 123 - operand + eq_expr test17.c 18:14 - operand + - isUsed: 1 + parm_decl ptr1 test17.c 16:25 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 19:16 - operand + modify_expr test17.c 19:16 - operand + result_decl test17.c 16:5 - operand + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + integer_cst 0 - operand + modify_expr test17.c 20:15 - statement + component_ref test17.c 20:9 - operand + indirect_ref test17.c 20:9 - object + - isUsed: 1 + parm_decl ptr1 test17.c 16:25 - ref + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + return_expr test17.c 21:12 - statement + modify_expr test17.c 21:12 - operand + result_decl test17.c 16:5 - operand + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + integer_cst 0 - operand + block - operand +test17.c: In function 'func3': +test17.c:26:14: warning: comparison between pointer and integer + if (ptr1 != (123, 0)) + ^ +function_decl func3 test17.c 24:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + tree_list - arg types + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + void_type - value + type_decl void - type name + result_decl test17.c 24:5 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + - isUsed: 1 + parm_decl ptr1 test17.c 24:25 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + parm_decl ptr2 test17.c 24:45 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + bind_expr test17.c 25:1 - code + statement_list - operand + cond_expr test17.c 26:8 - statement + compound_expr test17.c 26:14 - operand + integer_cst 123 - operand + ne_expr test17.c 26:14 - operand + - isUsed: 1 + parm_decl ptr1 test17.c 24:25 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 27:16 - operand + modify_expr test17.c 27:16 - operand + result_decl test17.c 24:5 - operand + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + integer_cst 0 - operand + modify_expr test17.c 28:15 - statement + component_ref test17.c 28:9 - operand + indirect_ref test17.c 28:9 - object + - isUsed: 1 + parm_decl ptr1 test17.c 24:25 - ref + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + return_expr test17.c 29:12 - statement + modify_expr test17.c 29:12 - operand + result_decl test17.c 24:5 - operand + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 32 - decl size + integer_cst 0 - operand + block - operand +function_decl func4 test17.c 32:6 +- isPublic: 1 + function_type - function type + void_type - function return type + type_decl void - type name + tree_list - arg types + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + void_type - value + type_decl void - type name + result_decl test17.c 32:6 - function result + - isAutogenerated: 1 + void_type - result type + type_decl void - type name + - isUsed: 1 + parm_decl ptr1 test17.c 32:26 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + parm_decl ptr2 test17.c 32:46 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + bind_expr test17.c 33:1 - code + statement_list - operand + cond_expr test17.c 34:8 - statement + eq_expr test17.c 34:11 - operand + var_decl k test17.c 6:5 - operand + - isUsed: 1 + integer_cst 32 - decl size + integer_type - var type + - precisionBits: 32 + - signed + type_decl int - type name + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 10 - operand + cond_expr test17.c 36:12 - operand + eq_expr test17.c 36:13 - operand + - isUsed: 1 + parm_decl ptr1 test17.c 32:26 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 37:13 - operand + modify_expr test17.c 40:15 - statement + component_ref test17.c 40:9 - operand + indirect_ref test17.c 40:9 - object + - isUsed: 1 + parm_decl ptr1 test17.c 32:26 - ref + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + block - operand +function_decl func5 test17.c 43:6 +- isPublic: 1 + function_type - function type + void_type - function return type + type_decl void - type name + tree_list - arg types + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + pointer_type - value + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + tree_list - chain + void_type - value + type_decl void - type name + result_decl test17.c 43:6 - function result + - isAutogenerated: 1 + void_type - result type + type_decl void - type name + - isUsed: 1 + parm_decl ptr1 test17.c 43:26 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + - isUsed: 1 + parm_decl ptr2 test17.c 43:46 - argument + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + bind_expr test17.c 44:1 - code + statement_list - operand + cond_expr test17.c 45:8 - statement + eq_expr test17.c 45:9 - operand + - isUsed: 1 + parm_decl ptr1 test17.c 43:26 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 46:9 - operand + cond_expr test17.c 48:8 - statement + ne_expr test17.c 48:9 - operand + - isUsed: 1 + parm_decl ptr2 test17.c 43:46 - operand + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + integer_cst 0 - operand + return_expr test17.c 49:9 - operand + modify_expr test17.c 51:15 - statement + component_ref test17.c 51:9 - operand + indirect_ref test17.c 51:9 - object + - isUsed: 1 + parm_decl ptr1 test17.c 43:26 - ref + pointer_type - decl type + record_type - nested type + identifier_node Data1 - type name + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 64 - parm size + field_decl val test17.c 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + block - operand diff --git a/test/test17-02.txt b/test/test17-02.txt new file mode 100644 index 0000000..334c6a4 --- /dev/null +++ b/test/test17-02.txt @@ -0,0 +1,13 @@ +func1: pointer_type ptr1, pointer_type ptr2, +test17.c: In function 'func2': +test17.c:18:14: warning: comparison between pointer and integer + if (ptr1 == (123, 0)) + ^ +func2: pointer_type ptr1, pointer_type ptr2, +test17.c: In function 'func3': +test17.c:26:14: warning: comparison between pointer and integer + if (ptr1 != (123, 0)) + ^ +func3: pointer_type ptr1, pointer_type ptr2, +func4: pointer_type ptr1, pointer_type ptr2, +func5: pointer_type ptr1, pointer_type ptr2, diff --git a/test/test17-03.txt b/test/test17-03.txt new file mode 100644 index 0000000..829c655 --- /dev/null +++ b/test/test17-03.txt @@ -0,0 +1,227 @@ +function_decl func1: +bind_expr : ptr1, ptr2, +statement_list : ptr1, ptr2, +cond_expr : ptr1, ptr2, +eq_expr : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +return_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +result_decl : ptr1, ptr2, +integer_type : ptr1, ptr2, +type_decl int: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst -2147483648: ptr1, ptr2, +integer_cst 2147483647: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr2, +indirect_ref : ptr2, +parm_decl ptr1: ptr2, +pointer_type : ptr2, +record_type : ptr2, +identifier_node Data1: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 64: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 100: ptr2, +block : ptr1, ptr2, +test17.c: In function 'func2': +test17.c:18:14: warning: comparison between pointer and integer + if (ptr1 == (123, 0)) + ^ +function_decl func2: +bind_expr : ptr1, ptr2, +statement_list : ptr1, ptr2, +cond_expr : ptr1, ptr2, +compound_expr : ptr1, ptr2, +integer_cst 123: ptr1, ptr2, +eq_expr : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +return_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +result_decl : ptr1, ptr2, +integer_type : ptr1, ptr2, +type_decl int: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst -2147483648: ptr1, ptr2, +integer_cst 2147483647: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr2, +indirect_ref : ptr2, +parm_decl ptr1: ptr2, +pointer_type : ptr2, +record_type : ptr2, +identifier_node Data1: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 64: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 100: ptr2, +return_expr : ptr1, ptr2, +modify_expr : ptr2, +result_decl : ptr2, +integer_type : ptr2, +type_decl int: ptr2, +integer_cst 32: ptr2, +integer_cst -2147483648: ptr2, +integer_cst 2147483647: ptr2, +integer_cst 32: ptr2, +integer_cst 0: ptr2, +block : ptr1, ptr2, +test17.c: In function 'func3': +test17.c:26:14: warning: comparison between pointer and integer + if (ptr1 != (123, 0)) + ^ +function_decl func3: +bind_expr : ptr1, ptr2, +statement_list : ptr1, ptr2, +cond_expr : ptr1, ptr2, +compound_expr : ptr1, ptr2, +integer_cst 123: ptr1, ptr2, +ne_expr : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +return_expr : ptr2, +modify_expr : ptr2, +result_decl : ptr2, +integer_type : ptr2, +type_decl int: ptr2, +integer_cst 32: ptr2, +integer_cst -2147483648: ptr2, +integer_cst 2147483647: ptr2, +integer_cst 32: ptr2, +integer_cst 0: ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr1, ptr2, +test17.c:28:9: warning: Using parameter 'ptr1' without checking for null pointer + ptr1->val = 100; + ^ +indirect_ref : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 100: ptr1, ptr2, +return_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +result_decl : ptr1, ptr2, +integer_type : ptr1, ptr2, +type_decl int: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst -2147483648: ptr1, ptr2, +integer_cst 2147483647: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +block : ptr1, ptr2, +function_decl func4: +bind_expr : ptr1, ptr2, +statement_list : ptr1, ptr2, +cond_expr : ptr1, ptr2, +eq_expr : ptr1, ptr2, +var_decl k: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_type : ptr1, ptr2, +type_decl int: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst -2147483648: ptr1, ptr2, +integer_cst 2147483647: ptr1, ptr2, +integer_cst 10: ptr1, ptr2, +cond_expr : ptr1, ptr2, +eq_expr : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +return_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr1, ptr2, +test17.c: In function 'func4': +test17.c:40:9: warning: Using parameter 'ptr1' without checking for null pointer + ptr1->val = 100; + ^ +indirect_ref : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 100: ptr1, ptr2, +block : ptr1, ptr2, +function_decl func5: +bind_expr : ptr1, ptr2, +statement_list : ptr1, ptr2, +cond_expr : ptr1, ptr2, +eq_expr : ptr1, ptr2, +parm_decl ptr1: ptr1, ptr2, +pointer_type : ptr1, ptr2, +record_type : ptr1, ptr2, +identifier_node Data1: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 64: ptr1, ptr2, +integer_cst 0: ptr1, ptr2, +return_expr : ptr1, ptr2, +cond_expr : ptr1, ptr2, +ne_expr : ptr2, +parm_decl ptr2: ptr2, +pointer_type : ptr2, +record_type : ptr2, +identifier_node Data1: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 64: ptr2, +integer_cst 0: ptr2, +return_expr : +modify_expr : ptr1, ptr2, +component_ref : ptr2, +indirect_ref : ptr2, +parm_decl ptr1: ptr2, +pointer_type : ptr2, +record_type : ptr2, +identifier_node Data1: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 64: ptr2, +field_decl val: ptr2, +integer_cst 32: ptr2, +integer_cst 100: ptr2, +block : ptr1, ptr2, diff --git a/test/test17-04.txt b/test/test17-04.txt new file mode 100644 index 0000000..1707c5f --- /dev/null +++ b/test/test17-04.txt @@ -0,0 +1,15 @@ +test17.c: In function 'func2': +test17.c:18:14: warning: comparison between pointer and integer + if (ptr1 == (123, 0)) + ^ +test17.c: In function 'func3': +test17.c:26:14: warning: comparison between pointer and integer + if (ptr1 != (123, 0)) + ^ +test17.c:28:9: warning: Using parameter 'ptr1' without checking for null pointer + ptr1->val = 100; + ^ +test17.c: In function 'func4': +test17.c:40:9: warning: Using parameter 'ptr1' without checking for null pointer + ptr1->val = 100; + ^ diff --git a/test/test17.c b/test/test17.c new file mode 100644 index 0000000..e830e26 --- /dev/null +++ b/test/test17.c @@ -0,0 +1,52 @@ +struct Data1 +{ + int val; +}; + +int k; + +int func1(struct Data1 *ptr1, struct Data1 *ptr2) +{ + if (ptr1 ? 0 : 1) + return(0); + + ptr1->val = 100; +} + +int func2(struct Data1 *ptr1, struct Data1 *ptr2) +{ + if (ptr1 == (123, 0)) + return 0; + ptr1->val = 100; + return 0; +} + +int func3(struct Data1 *ptr1, struct Data1 *ptr2) +{ + if (ptr1 != (123, 0)) + return 0; + ptr1->val = 100; + return 0; +} + +void func4(struct Data1 *ptr1, struct Data1 *ptr2) +{ + if (k == 10) + { + if (!ptr1) + return; + } + + ptr1->val = 100; +} + +void func5(struct Data1 *ptr1, struct Data1 *ptr2) +{ + if (!ptr1) + return; + + if (ptr2) + return; + + ptr1->val = 100; +} |