diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-22 15:14:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-22 15:14:48 +0300 |
commit | b100924afec4ff884e350c1e65e273ef83c15bd2 (patch) | |
tree | b101f53417273b5820d3fc5cd2a08eeab0fb1720 | |
parent | 2b1669cebbdb14ff93bd455439e31682fbd9c548 (diff) | |
download | paranucker-b100924afec4ff884e350c1e65e273ef83c15bd2.tar.gz paranucker-b100924afec4ff884e350c1e65e273ef83c15bd2.tar.bz2 paranucker-b100924afec4ff884e350c1e65e273ef83c15bd2.tar.xz paranucker-b100924afec4ff884e350c1e65e273ef83c15bd2.zip |
Add test 19.
-rw-r--r-- | test/Makefile | 13 | ||||
-rw-r--r-- | test/test19-01.txt | 459 | ||||
-rw-r--r-- | test/test19-02.txt | 4 | ||||
-rw-r--r-- | test/test19-03.txt | 144 | ||||
-rw-r--r-- | test/test19-04.txt | 4 | ||||
-rw-r--r-- | test/test19.cpp | 33 |
6 files changed, 656 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile index 78f664d..5a5398c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -17,7 +17,8 @@ TESTS15 = test15-01 test15-02 test15-03 test15-04 TESTS16 = test16-01 test16-02 test16-03 test16-04 TESTS17 = test17-01 test17-02 test17-03 test17-04 TESTS18 = test18-01 test18-02 test18-03 test18-04 -ALLTESTS = test01 test02 test03 test04 test05 test06 test07 test08 test09 test10 test11 test12 test13 test14 test15 test16 test17 test18 ${TESTS01} ${TESTS02} ${TESTS03} ${TESTS04} ${TESTS05} ${TESTS06} ${TESTS07} ${TESTS08} ${TESTS09} ${TESTS10} ${TESTS11} ${TESTS12} ${TESTS13} ${TESTS14} ${TESTS15} ${TESTS16} ${TESTS17} ${TESTS18} +TESTS19 = test19-01 test19-02 test19-03 test19-04 +ALLTESTS = test01 test02 test03 test04 test05 test06 test07 test08 test09 test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 ${TESTS01} ${TESTS02} ${TESTS03} ${TESTS04} ${TESTS05} ${TESTS06} ${TESTS07} ${TESTS08} ${TESTS09} ${TESTS10} ${TESTS11} ${TESTS12} ${TESTS13} ${TESTS14} ${TESTS15} ${TESTS16} ${TESTS17} ${TESTS18} ${TESTS19} .PHONY: ${ALLTESTS} ${CRASHES} all crashes @@ -211,6 +212,16 @@ test18-03: test18-04: $(call CMDXX,detectnullpointers,test18.cpp,test18-04.txt) +test19: ${TESTS19} +test19-01: + $(call CMDXX,dump,test19.cpp,test19-01.txt) +test19-02: + $(call CMDXX,findargs,test19.cpp,test19-02.txt) +test19-03: + $(call CMDXX,dumpnullpointers,test19.cpp,test19-03.txt) +test19-04: + $(call CMDXX,detectnullpointers,test19.cpp,test19-04.txt) + crashtest01: $(call CMDXX,dump,crashtest01.h,crashtest01-01.txt) crashtest02: diff --git a/test/test19-01.txt b/test/test19-01.txt new file mode 100644 index 0000000..5c5e162 --- /dev/null +++ b/test/test19-01.txt @@ -0,0 +1,459 @@ +function_decl func1 test19.cpp 8:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + result_decl test19.cpp 8:49 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 test19.cpp 8:25 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + parm_decl ptr2 test19.cpp 8:45 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + bind_expr test19.cpp 10:23 - code + var_decl ptr3 test19.cpp 10:12 - operand + integer_cst 64 - decl size + - isUsed: 1 + parm_decl ptr1 test19.cpp 8:25 - initial + pointer_type - var type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + decl_expr test19.cpp 10:19 - operand + var_decl ptr3 test19.cpp 10:12 - operand + block - operand + var_decl ptr3 test19.cpp 10:12 - block vars +function_decl func2 test19.cpp 13:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + result_decl test19.cpp 13:49 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 test19.cpp 13:25 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + parm_decl ptr2 test19.cpp 13:45 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + bind_expr test19.cpp 16:20 - code + var_decl ptr3 test19.cpp 15:12 - operand + - isUsed: 1 + integer_cst 64 - decl size + - isUsed: 1 + parm_decl ptr1 test19.cpp 13:25 - initial + pointer_type - var type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + statement_list - operand + decl_expr test19.cpp 15:19 - statement + var_decl ptr3 test19.cpp 15:12 - operand + - isUsed: 1 + cleanup_point_expr test19.cpp 16:20 - statement + expr_stmt test19.cpp 16:20 - operand + convert_expr - expresssion + modify_expr - operand + component_ref test19.cpp 16:11 - operand + indirect_ref - object + var_decl ptr3 test19.cpp 15:12 - ref + - isUsed: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + block - operand + var_decl ptr3 test19.cpp 15:12 - block vars + - isUsed: 1 +function_decl func3 test19.cpp 19:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + result_decl test19.cpp 19:49 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 test19.cpp 19:25 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + parm_decl ptr2 test19.cpp 19:45 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + bind_expr test19.cpp 23:24 - code + var_decl ptr3 test19.cpp 21:12 - operand + - isUsed: 1 + integer_cst 64 - decl size + - isUsed: 1 + parm_decl ptr1 test19.cpp 19:25 - initial + pointer_type - var type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + statement_list - operand + decl_expr test19.cpp 21:19 - statement + var_decl ptr3 test19.cpp 21:12 - operand + - isUsed: 1 + if_stmt test19.cpp 22:5 - statement + ne_expr - condition + var_decl ptr3 test19.cpp 21:12 - operand + - isUsed: 1 + integer_cst 0 - operand + cleanup_point_expr test19.cpp 23:24 - then + expr_stmt test19.cpp 23:24 - operand + convert_expr - expresssion + modify_expr - operand + component_ref test19.cpp 23:15 - operand + indirect_ref - object + var_decl ptr3 test19.cpp 21:12 - ref + - isUsed: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + block - operand + var_decl ptr3 test19.cpp 21:12 - block vars + - isUsed: 1 +function_decl func4 test19.cpp 26:5 +- isPublic: 1 + function_type - function type + integer_type - function return type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + pointer_type - value + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + result_decl test19.cpp 26:49 - function result + - isAutogenerated: 1 + integer_type - result type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + 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 test19.cpp 26:25 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + - isUsed: 1 + parm_decl ptr2 test19.cpp 26:45 - argument + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + bind_expr test19.cpp 32:24 - code + var_decl ptr3 test19.cpp 28:12 - operand + - isUsed: 1 + integer_cst 64 - decl size + - isUsed: 1 + parm_decl ptr1 test19.cpp 26:25 - initial + pointer_type - var type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + statement_list - operand + decl_expr test19.cpp 28:19 - statement + var_decl ptr3 test19.cpp 28:12 - operand + - isUsed: 1 + if_stmt test19.cpp 29:5 - statement + ne_expr - condition + var_decl ptr3 test19.cpp 28:12 - operand + - isUsed: 1 + integer_cst 0 - operand + cleanup_point_expr test19.cpp 30:24 - then + expr_stmt test19.cpp 30:24 - operand + convert_expr - expresssion + modify_expr - operand + component_ref test19.cpp 30:15 - operand + indirect_ref - object + var_decl ptr3 test19.cpp 28:12 - ref + - isUsed: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 100 - operand + if_stmt test19.cpp 31:10 - else + truth_andif_expr test19.cpp 31:20 - condition + eq_expr test19.cpp 31:15 - operand + - isUsed: 1 + parm_decl ptr1 test19.cpp 26:25 - operand + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + integer_cst 0 - operand + ne_expr - operand + - isUsed: 1 + parm_decl ptr2 test19.cpp 26:45 - operand + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + integer_cst 0 - operand + cleanup_point_expr test19.cpp 32:24 - then + expr_stmt test19.cpp 32:24 - operand + convert_expr - expresssion + modify_expr - operand + component_ref test19.cpp 32:15 - operand + indirect_ref - object + - isUsed: 1 + parm_decl ptr2 test19.cpp 26:45 - ref + pointer_type - decl type + record_type - nested type + type_decl Data1 test19.cpp 1:8 - type name + - isAutogenerated: 1 + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + type_decl Data1 test19.cpp 2:1 - field + - isAutogenerated: 1 + integer_cst 64 - parm size + field_decl val test19.cpp 3:9 - field + - signed + integer_cst 32 - decl size + integer_cst 200 - operand + block - operand + var_decl ptr3 test19.cpp 28:12 - block vars + - isUsed: 1 diff --git a/test/test19-02.txt b/test/test19-02.txt new file mode 100644 index 0000000..ddafb35 --- /dev/null +++ b/test/test19-02.txt @@ -0,0 +1,4 @@ +func1: pointer_type ptr1, pointer_type ptr2, +func2: pointer_type ptr1, pointer_type ptr2, +func3: pointer_type ptr1, pointer_type ptr2, +func4: pointer_type ptr1, pointer_type ptr2, diff --git a/test/test19-03.txt b/test/test19-03.txt new file mode 100644 index 0000000..1ec285d --- /dev/null +++ b/test/test19-03.txt @@ -0,0 +1,144 @@ +function_decl func1: +bind_expr : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +parm_decl ptr1: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +decl_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +block : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +function_decl func2: +bind_expr : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +parm_decl ptr1: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +statement_list : ptr1, ptr2, ptr3, +decl_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +cleanup_point_expr : ptr1, ptr2, ptr3, +expr_stmt : ptr1, ptr2, ptr3, +convert_expr : ptr1, ptr2, ptr3, +modify_expr : ptr1, ptr2, ptr3, +component_ref : ptr1, ptr2, ptr3, +test19.cpp: In function 'int func2(Data1*, Data1*)': +test19.cpp:16:11: warning: Using variable 'ptr3' without checking for null pointer + ptr3->val = 100; + ^ +indirect_ref : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +integer_cst 100: ptr1, ptr2, ptr3, +block : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +function_decl func3: +bind_expr : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +parm_decl ptr1: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +statement_list : ptr1, ptr2, ptr3, +decl_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +if_stmt : ptr1, ptr2, ptr3, +ne_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 0: ptr1, ptr2, ptr3, +cleanup_point_expr : ptr1, ptr2, +expr_stmt : ptr1, ptr2, +convert_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr1, ptr2, +indirect_ref : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 100: ptr1, ptr2, +block : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +function_decl func4: +bind_expr : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +parm_decl ptr1: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +statement_list : ptr1, ptr2, ptr3, +decl_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +if_stmt : ptr1, ptr2, ptr3, +ne_expr : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, +integer_cst 0: ptr1, ptr2, ptr3, +cleanup_point_expr : ptr1, ptr2, +expr_stmt : ptr1, ptr2, +convert_expr : ptr1, ptr2, +modify_expr : ptr1, ptr2, +component_ref : ptr1, ptr2, +indirect_ref : ptr1, ptr2, +var_decl ptr3: ptr1, ptr2, +field_decl val: ptr1, ptr2, +integer_cst 32: ptr1, ptr2, +integer_cst 100: ptr1, ptr2, +if_stmt : ptr1, ptr2, ptr3, +truth_andif_expr : ptr1, ptr2, ptr3, +eq_expr : ptr1, ptr2, ptr3, +parm_decl ptr1: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +integer_cst 0: ptr1, ptr2, ptr3, +ne_expr : ptr1, ptr2, ptr3, +parm_decl ptr2: ptr1, ptr2, ptr3, +pointer_type : ptr1, ptr2, ptr3, +record_type : ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +field_decl val: ptr1, ptr2, ptr3, +integer_cst 32: ptr1, ptr2, ptr3, +type_decl Data1: ptr1, ptr2, ptr3, +integer_cst 64: ptr1, ptr2, ptr3, +integer_cst 0: ptr1, ptr2, ptr3, +cleanup_point_expr : ptr1, ptr3, +expr_stmt : ptr1, ptr3, +convert_expr : ptr1, ptr3, +modify_expr : ptr1, ptr3, +component_ref : ptr1, ptr3, +indirect_ref : ptr1, ptr3, +parm_decl ptr2: ptr1, ptr3, +pointer_type : ptr1, ptr3, +record_type : ptr1, ptr3, +type_decl Data1: ptr1, ptr3, +field_decl val: ptr1, ptr3, +integer_cst 32: ptr1, ptr3, +type_decl Data1: ptr1, ptr3, +integer_cst 64: ptr1, ptr3, +field_decl val: ptr1, ptr3, +integer_cst 32: ptr1, ptr3, +integer_cst 200: ptr1, ptr3, +block : ptr1, ptr2, ptr3, +var_decl ptr3: ptr1, ptr2, ptr3, diff --git a/test/test19-04.txt b/test/test19-04.txt new file mode 100644 index 0000000..4aa1386 --- /dev/null +++ b/test/test19-04.txt @@ -0,0 +1,4 @@ +test19.cpp: In function 'int func2(Data1*, Data1*)': +test19.cpp:16:11: warning: Using variable 'ptr3' without checking for null pointer + ptr3->val = 100; + ^ diff --git a/test/test19.cpp b/test/test19.cpp new file mode 100644 index 0000000..56e7a6e --- /dev/null +++ b/test/test19.cpp @@ -0,0 +1,33 @@ +struct Data1 +{ + int val; +}; + +int k; + +int func1(struct Data1 *ptr1, struct Data1 *ptr2) +{ + Data1 *ptr3 = ptr1; +} + +int func2(struct Data1 *ptr1, struct Data1 *ptr2) +{ + Data1 *ptr3 = ptr1; + ptr3->val = 100; +} + +int func3(struct Data1 *ptr1, struct Data1 *ptr2) +{ + Data1 *ptr3 = ptr1; + if (ptr3) + ptr3->val = 100; +} + +int func4(struct Data1 *ptr1, struct Data1 *ptr2) +{ + Data1 *ptr3 = ptr1; + if (ptr3) + ptr3->val = 100; + else if (!ptr1 && ptr2) + ptr2->val = 200; +} |