diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll index eeb7adf9a16..4fb9bc42e82 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll @@ -44,7 +44,7 @@ newtype TValueNumber = TCallValueNumber(TCallPartialValueNumber vn) { callValueNumber(_, _, vn) } or TUniqueValueNumber(IRFunction irFunc, Instruction instr) { uniqueValueNumber(instr, irFunc) } -newtype TCallPartialValueNumber = +private newtype TCallPartialValueNumber = TNilArgument() or TArgument(TCallPartialValueNumber head, TValueNumber arg) { exists(CallInstruction call, int index | @@ -53,7 +53,7 @@ newtype TCallPartialValueNumber = ) } -predicate callValueNumber(CallInstruction call, int index, TCallPartialValueNumber vn) { +private predicate callValueNumber(CallInstruction call, int index, TCallPartialValueNumber vn) { index = max(int n | callArgRank(call, n, _) | n) and exists(TCallPartialValueNumber head, TValueNumber arg | callPartialValueNumber(call, index, pragma[only_bind_out](head)) and @@ -61,16 +61,17 @@ predicate callValueNumber(CallInstruction call, int index, TCallPartialValueNumb vn = TArgument(head, arg) ) or + not call.getResultIRType() instanceof IRVoidType and not exists(int n | callArgRank(call, n, _)) and index = -1 and vn = TNilArgument() } -predicate callPartialValueNumber(CallInstruction call, int index, TCallPartialValueNumber head) { - index = 1 and head = TNilArgument() and exists(call) +private predicate callPartialValueNumber(CallInstruction call, int index, TCallPartialValueNumber head) { + index = 1 and head = TNilArgument() and not call.getResultIRType() instanceof IRVoidType or exists(TCallPartialValueNumber prev, TValueNumber prevVN | - callPartialValueNumber(call, index - 1, pragma[only_bind_out](prev)) and + callPartialValueNumber(call, index - 1, pragma[only_bind_out](prev)) and callArgValueNumber(call, index - 1, pragma[only_bind_into](prevVN)) and head = TArgument(prev, prevVN) ) @@ -78,7 +79,8 @@ predicate callPartialValueNumber(CallInstruction call, int index, TCallPartialVa /** */ -predicate callArgValueNumber(CallInstruction call, int index, TValueNumber arg) { +private predicate callArgValueNumber(CallInstruction call, int index, TValueNumber arg) { + not call.getResultIRType() instanceof IRVoidType and exists(Instruction instr | callArgRank(call, index, instr) and arg = tvalueNumber(instr) @@ -89,21 +91,21 @@ predicate callArgValueNumber(CallInstruction call, int index, TValueNumber arg) * Holds if `arg` is the `index`th element in `call`'s extended argument list, including the `this` * argument and side-effect reads. */ -predicate callArgRank(CallInstruction call, int index, Instruction arg) { +private predicate callArgRank(CallInstruction call, int index, Instruction arg) { arg = rank[index](int argIndex, boolean isEffect, Instruction instr | exists(CallSideEffectInstruction cse | cse.getPrimaryInstruction() = call and cse.getSideEffectOperand().getAnyDef() = instr and argIndex = -2 and - isEffect = false + isEffect = true ) or exists(CallReadSideEffectInstruction cse | cse.getPrimaryInstruction() = call and cse.getSideEffectOperand().getAnyDef() = instr and argIndex = -2 and - isEffect = false + isEffect = true ) or instr = call.getThisArgument() and @@ -115,7 +117,7 @@ predicate callArgRank(CallInstruction call, int index, Instruction arg) { or exists(ReadSideEffectInstruction read | read.getPrimaryInstruction() = call and - read.getSideEffectOperand().getDef() = instr and + read.getSideEffectOperand().getAnyDef() = instr and read.getIndex() = argIndex and isEffect = true ) diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_ir_gvn.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_ir_gvn.expected index 0671cdf1db9..2c9bfea9b85 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_ir_gvn.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ast_ir_gvn.expected @@ -12,7 +12,6 @@ | test.cpp:29:7:29:8 | GVN | 29:c7-c8 31:c7-c8 | | test.cpp:29:7:29:13 | GVN | 29:c7-c13 31:c7-c13 | | test.cpp:29:12:29:13 | GVN | 29:c12-c13 31:c12-c13 | -| test.cpp:30:3:30:17 | GVN | 30:c3-c17 77:c20-c28 80:c9-c17 | | test.cpp:31:7:31:24 | GVN | 31:c7-c24 32:c7-c7 | | test.cpp:43:3:43:3 | GVN | 43:c3-c3 45:c3-c3 | | test.cpp:43:7:43:8 | GVN | 43:c7-c8 45:c7-c8 | @@ -29,7 +28,7 @@ | test.cpp:56:13:56:16 | GVN | 56:c13-c16 56:c31-c34 59:c9-c12 | | test.cpp:56:14:56:16 | GVN | 56:c14-c16 56:c32-c34 56:c47-c49 59:c10-c12 | | test.cpp:62:5:62:10 | GVN | 62:c5-c10 65:c10-c15 | -| test.cpp:77:20:77:28 | GVN | 77:c20-c28 79:c7-c7 80:c9-c17 | +| test.cpp:77:20:77:28 | GVN | 77:c20-c28 79:c7-c7 | | test.cpp:79:11:79:14 | GVN | 79:c11-c14 79:c24-c27 | | test.cpp:92:11:92:16 | GVN | 92:c11-c16 92:c15-c16 93:c10-c10 | | test.cpp:105:11:105:12 | GVN | 105:c11-c12 106:c33-c34 | @@ -45,12 +44,11 @@ | test.cpp:144:15:144:15 | GVN | 144:c15-c15 149:c15-c15 | | test.cpp:153:11:153:18 | GVN | 153:c11-c18 154:c11-c18 156:c3-c10 | | test.cpp:153:21:153:21 | GVN | 153:c21-c21 154:c21-c21 | -| test.cpp:166:11:166:16 | GVN | 166:c11-c16 167:c11-c16 173:c11-c16 | +| test.cpp:166:11:166:16 | GVN | 166:c11-c16 167:c11-c16 | | test.cpp:166:18:166:20 | GVN | 166:c18-c20 167:c18-c20 171:c10-c12 173:c18-c20 | | test.cpp:166:18:166:20 | GVN | 166:c18-c20 167:c18-c20 173:c18-c20 | | test.cpp:168:11:168:16 | GVN | 168:c11-c16 169:c11-c16 174:c11-c16 | | test.cpp:168:18:168:20 | GVN | 168:c18-c20 169:c18-c20 171:c15-c17 174:c18-c20 | | test.cpp:168:18:168:20 | GVN | 168:c18-c20 169:c18-c20 171:c15-c17 174:c18-c20 | -| test.cpp:176:3:176:5 | GVN | 176:c3-c5 178:c3-c5 | | test.cpp:176:7:176:7 | GVN | 176:c7-c7 178:c7-c7 | | test.cpp:176:10:176:10 | GVN | 176:c10-c10 178:c10-c10 | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected index d9232b53245..127e1781f83 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected @@ -10,8 +10,7 @@ | test.cpp:21:16:21:16 | 2 | test.cpp:178:10:178:10 | 2 | AST only | | test.cpp:29:3:29:3 | x | test.cpp:31:3:31:3 | x | IR only | | test.cpp:29:3:29:24 | ... = ... | test.cpp:29:3:29:24 | ... = ... | AST only | -| test.cpp:30:3:30:17 | call to change_global02 | test.cpp:77:20:77:28 | call to getAValue | IR only | -| test.cpp:30:3:30:17 | call to change_global02 | test.cpp:80:9:80:17 | call to getAValue | IR only | +| test.cpp:30:3:30:17 | call to change_global02 | test.cpp:30:3:30:17 | call to change_global02 | AST only | | test.cpp:31:3:31:3 | x | test.cpp:29:3:29:3 | x | IR only | | test.cpp:31:3:31:24 | ... = ... | test.cpp:31:3:31:24 | ... = ... | AST only | | test.cpp:32:3:32:7 | ... = ... | test.cpp:32:3:32:7 | ... = ... | AST only | @@ -78,21 +77,15 @@ | test.cpp:59:17:59:20 | (int)... | test.cpp:59:17:59:20 | (int)... | AST only | | test.cpp:59:17:59:20 | (int)... | test.cpp:88:12:88:12 | 0 | AST only | | test.cpp:62:5:62:12 | ... ++ | test.cpp:62:5:62:12 | ... ++ | AST only | -| test.cpp:77:20:77:28 | call to getAValue | test.cpp:30:3:30:17 | call to change_global02 | IR only | | test.cpp:77:20:77:28 | call to getAValue | test.cpp:79:7:79:7 | v | IR only | -| test.cpp:77:20:77:28 | call to getAValue | test.cpp:80:9:80:17 | call to getAValue | IR only | | test.cpp:77:20:77:30 | (signed short)... | test.cpp:77:20:77:30 | (signed short)... | AST only | | test.cpp:77:20:77:30 | (signed short)... | test.cpp:79:7:79:7 | v | AST only | | test.cpp:79:7:79:7 | (int)... | test.cpp:79:7:79:7 | (int)... | AST only | | test.cpp:79:7:79:7 | v | test.cpp:77:20:77:28 | call to getAValue | IR only | | test.cpp:79:7:79:7 | v | test.cpp:77:20:77:30 | (signed short)... | AST only | -| test.cpp:79:7:79:7 | v | test.cpp:80:9:80:17 | call to getAValue | IR only | | test.cpp:79:11:79:20 | (int)... | test.cpp:79:11:79:20 | (int)... | AST only | | test.cpp:79:24:79:33 | (int)... | test.cpp:79:24:79:33 | (int)... | AST only | | test.cpp:80:5:80:19 | ... = ... | test.cpp:80:5:80:19 | ... = ... | AST only | -| test.cpp:80:9:80:17 | call to getAValue | test.cpp:30:3:30:17 | call to change_global02 | IR only | -| test.cpp:80:9:80:17 | call to getAValue | test.cpp:77:20:77:28 | call to getAValue | IR only | -| test.cpp:80:9:80:17 | call to getAValue | test.cpp:79:7:79:7 | v | IR only | | test.cpp:80:9:80:19 | (signed short)... | test.cpp:80:9:80:19 | (signed short)... | AST only | | test.cpp:88:3:88:20 | ... = ... | test.cpp:88:3:88:20 | ... = ... | AST only | | test.cpp:88:12:88:12 | 0 | test.cpp:44:9:44:9 | 0 | AST only | @@ -140,12 +133,10 @@ | test.cpp:149:15:149:15 | x | test.cpp:144:15:144:15 | x | IR only | | test.cpp:156:3:156:17 | ... = ... | test.cpp:156:3:156:17 | ... = ... | AST only | | test.cpp:166:11:166:16 | call to strlen | test.cpp:167:11:167:16 | call to strlen | IR only | -| test.cpp:166:11:166:16 | call to strlen | test.cpp:173:11:173:16 | call to strlen | IR only | | test.cpp:166:18:166:20 | (const char *)... | test.cpp:166:18:166:20 | (const char *)... | AST only | | test.cpp:166:18:166:20 | (const char *)... | test.cpp:167:18:167:20 | (const char *)... | AST only | | test.cpp:166:18:166:20 | (const char *)... | test.cpp:173:18:173:20 | (const char *)... | AST only | | test.cpp:167:11:167:16 | call to strlen | test.cpp:166:11:166:16 | call to strlen | IR only | -| test.cpp:167:11:167:16 | call to strlen | test.cpp:173:11:173:16 | call to strlen | IR only | | test.cpp:167:18:167:20 | (const char *)... | test.cpp:166:18:166:20 | (const char *)... | AST only | | test.cpp:167:18:167:20 | (const char *)... | test.cpp:167:18:167:20 | (const char *)... | AST only | | test.cpp:167:18:167:20 | (const char *)... | test.cpp:173:18:173:20 | (const char *)... | AST only | @@ -165,8 +156,6 @@ | test.cpp:171:15:171:17 | (const char *)... | test.cpp:169:18:169:20 | (const char *)... | AST only | | test.cpp:171:15:171:17 | (const char *)... | test.cpp:171:15:171:17 | (const char *)... | AST only | | test.cpp:171:15:171:17 | (const char *)... | test.cpp:174:18:174:20 | (const char *)... | AST only | -| test.cpp:173:11:173:16 | call to strlen | test.cpp:166:11:166:16 | call to strlen | IR only | -| test.cpp:173:11:173:16 | call to strlen | test.cpp:167:11:167:16 | call to strlen | IR only | | test.cpp:173:18:173:20 | (const char *)... | test.cpp:166:18:166:20 | (const char *)... | AST only | | test.cpp:173:18:173:20 | (const char *)... | test.cpp:167:18:167:20 | (const char *)... | AST only | | test.cpp:173:18:173:20 | (const char *)... | test.cpp:173:18:173:20 | (const char *)... | AST only | @@ -176,10 +165,8 @@ | test.cpp:174:18:174:20 | (const char *)... | test.cpp:169:18:169:20 | (const char *)... | AST only | | test.cpp:174:18:174:20 | (const char *)... | test.cpp:171:15:171:17 | (const char *)... | AST only | | test.cpp:174:18:174:20 | (const char *)... | test.cpp:174:18:174:20 | (const char *)... | AST only | -| test.cpp:176:3:176:5 | call to add | test.cpp:178:3:178:5 | call to add | IR only | | test.cpp:176:7:176:7 | 1 | test.cpp:10:16:10:16 | 1 | AST only | | test.cpp:176:10:176:10 | 2 | test.cpp:21:16:21:16 | 2 | AST only | | test.cpp:177:7:177:7 | 3 | test.cpp:35:16:35:16 | 3 | AST only | -| test.cpp:178:3:178:5 | call to add | test.cpp:176:3:176:5 | call to add | IR only | | test.cpp:178:7:178:7 | 1 | test.cpp:10:16:10:16 | 1 | AST only | | test.cpp:178:10:178:10 | 2 | test.cpp:21:16:21:16 | 2 | AST only | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected index bf1c05c4c43..c6f106b236f 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected @@ -237,7 +237,6 @@ test.cpp: # 30| r30_1(glval) = FunctionAddress[change_global02] : # 30| valnum = unique # 30| v30_2(void) = Call[change_global02] : func:r30_1 -# 30| valnum = r77_3, r80_2, v30_2 # 30| m30_3(unknown) = ^CallSideEffect : ~m25_4 # 30| valnum = unique # 30| m30_4(unknown) = Chi : total:m25_4, partial:m30_3 @@ -591,19 +590,19 @@ test.cpp: # 77| r77_2(glval) = FunctionAddress[getAValue] : # 77| valnum = unique # 77| r77_3(int) = Call[getAValue] : func:r77_2 -# 77| valnum = r77_3, r80_2, v30_2 +# 77| valnum = unique # 77| m77_4(unknown) = ^CallSideEffect : ~m75_4 # 77| valnum = unique # 77| m77_5(unknown) = Chi : total:m75_4, partial:m77_4 # 77| valnum = unique # 77| r77_6(signed short) = Convert : r77_3 -# 77| valnum = m77_7, m80_7, r77_6, r79_2, r80_5 +# 77| valnum = m77_7, r77_6, r79_2 # 77| m77_7(signed short) = Store[v] : &:r77_1, r77_6 -# 77| valnum = m77_7, m80_7, r77_6, r79_2, r80_5 +# 77| valnum = m77_7, r77_6, r79_2 # 79| r79_1(glval) = VariableAddress[v] : # 79| valnum = r77_1, r79_1, r80_6 # 79| r79_2(signed short) = Load[v] : &:r79_1, m77_7 -# 79| valnum = m77_7, m80_7, r77_6, r79_2, r80_5 +# 79| valnum = m77_7, r77_6, r79_2 # 79| r79_3(int) = Convert : r79_2 # 79| valnum = unique # 79| r79_4(glval) = VariableAddress[vals] : @@ -638,17 +637,17 @@ test.cpp: # 80| r80_1(glval) = FunctionAddress[getAValue] : # 80| valnum = unique # 80| r80_2(int) = Call[getAValue] : func:r80_1 -# 80| valnum = r77_3, r80_2, v30_2 +# 80| valnum = unique # 80| m80_3(unknown) = ^CallSideEffect : ~m77_5 # 80| valnum = unique # 80| m80_4(unknown) = Chi : total:m77_5, partial:m80_3 # 80| valnum = unique # 80| r80_5(signed short) = Convert : r80_2 -# 80| valnum = m77_7, m80_7, r77_6, r79_2, r80_5 +# 80| valnum = m80_7, r80_5 # 80| r80_6(glval) = VariableAddress[v] : # 80| valnum = r77_1, r79_1, r80_6 # 80| m80_7(signed short) = Store[v] : &:r80_6, r80_5 -# 80| valnum = m77_7, m80_7, r77_6, r79_2, r80_5 +# 80| valnum = m80_7, r80_5 #-----| Goto -> Block 2 # 82| Block 2 @@ -1147,6 +1146,43 @@ test.cpp: # 152| v152_8(void) = AliasedUse : ~m156_7 # 152| v152_9(void) = ExitFunction : +# 163| int add(int, int) +# 163| Block 0 +# 163| v163_1(void) = EnterFunction : +# 163| m163_2(unknown) = AliasedDefinition : +# 163| valnum = unique +# 163| m163_3(unknown) = InitializeNonLocal : +# 163| valnum = unique +# 163| m163_4(unknown) = Chi : total:m163_2, partial:m163_3 +# 163| valnum = unique +# 163| r163_5(glval) = VariableAddress[a] : +# 163| valnum = r163_10, r163_5 +# 163| m163_6(int) = InitializeParameter[a] : &:r163_5 +# 163| valnum = m163_6, r163_11 +# 163| r163_7(glval) = VariableAddress[b] : +# 163| valnum = r163_12, r163_7 +# 163| m163_8(int) = InitializeParameter[b] : &:r163_7 +# 163| valnum = m163_8, r163_13 +# 163| r163_9(glval) = VariableAddress[#return] : +# 163| valnum = r163_16, r163_9 +# 163| r163_10(glval) = VariableAddress[a] : +# 163| valnum = r163_10, r163_5 +# 163| r163_11(int) = Load[a] : &:r163_10, m163_6 +# 163| valnum = m163_6, r163_11 +# 163| r163_12(glval) = VariableAddress[b] : +# 163| valnum = r163_12, r163_7 +# 163| r163_13(int) = Load[b] : &:r163_12, m163_8 +# 163| valnum = m163_8, r163_13 +# 163| r163_14(int) = Add : r163_11, r163_13 +# 163| valnum = m163_15, r163_14 +# 163| m163_15(int) = Store[#return] : &:r163_9, r163_14 +# 163| valnum = m163_15, r163_14 +# 163| r163_16(glval) = VariableAddress[#return] : +# 163| valnum = r163_16, r163_9 +# 163| v163_17(void) = ReturnValue : &:r163_16, m163_15 +# 163| v163_18(void) = AliasedUse : m163_3 +# 163| v163_19(void) = ExitFunction : + # 165| void test_func_value_numbering(char*, char*) # 165| Block 0 # 165| v165_1(void) = EnterFunction : @@ -1183,10 +1219,10 @@ test.cpp: # 166| r166_5(char *) = Convert : r166_4 # 166| valnum = r166_5, r167_5, r173_5 # 166| r166_6(int) = Call[strlen] : func:r166_2, 0:r166_5 -# 166| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 166| valnum = m166_8, m167_8, r166_6, r167_6 # 166| v166_7(void) = ^BufferReadSideEffect[0] : &:r166_5, ~m165_8 # 166| m166_8(int) = Store[a] : &:r166_1, r166_6 -# 166| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 166| valnum = m166_8, m167_8, r166_6, r167_6 # 167| r167_1(glval) = VariableAddress[b] : # 167| valnum = unique # 167| r167_2(glval) = FunctionAddress[strlen] : @@ -1198,10 +1234,10 @@ test.cpp: # 167| r167_5(char *) = Convert : r167_4 # 167| valnum = r166_5, r167_5, r173_5 # 167| r167_6(int) = Call[strlen] : func:r167_2, 0:r167_5 -# 167| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 167| valnum = m166_8, m167_8, r166_6, r167_6 # 167| v167_7(void) = ^BufferReadSideEffect[0] : &:r167_5, ~m165_8 # 167| m167_8(int) = Store[b] : &:r167_1, r167_6 -# 167| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 167| valnum = m166_8, m167_8, r166_6, r167_6 # 168| r168_1(glval) = VariableAddress[c] : # 168| valnum = unique # 168| r168_2(glval) = FunctionAddress[strlen] : @@ -1263,10 +1299,10 @@ test.cpp: # 173| r173_5(char *) = Convert : r173_4 # 173| valnum = r166_5, r167_5, r173_5 # 173| r173_6(int) = Call[strlen] : func:r173_2, 0:r173_5 -# 173| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 173| valnum = m173_8, r173_6 # 173| v173_7(void) = ^BufferReadSideEffect[0] : &:r173_5, ~m171_11 # 173| m173_8(int) = Store[e] : &:r173_1, r173_6 -# 173| valnum = m166_8, m167_8, m173_8, r166_6, r167_6, r173_6 +# 173| valnum = m173_8, r173_6 # 174| r174_1(glval) = VariableAddress[f] : # 174| valnum = unique # 174| r174_2(glval) = FunctionAddress[strlen] : @@ -1290,10 +1326,6 @@ test.cpp: # 176| valnum = r176_3, r178_3 # 176| r176_4(int) = Call[add] : func:r176_1, 0:r176_2, 1:r176_3 # 176| valnum = r176_4, r178_4 -# 176| m176_5(unknown) = ^CallSideEffect : ~m165_4 -# 176| valnum = unique -# 176| m176_6(unknown) = Chi : total:m165_4, partial:m176_5 -# 176| valnum = unique # 177| r177_1(glval) = FunctionAddress[add] : # 177| valnum = unique # 177| r177_2(int) = Constant[3] : @@ -1302,10 +1334,6 @@ test.cpp: # 177| valnum = unique # 177| r177_4(int) = Call[add] : func:r177_1, 0:r177_2, 1:r177_3 # 177| valnum = unique -# 177| m177_5(unknown) = ^CallSideEffect : ~m176_6 -# 177| valnum = unique -# 177| m177_6(unknown) = Chi : total:m176_6, partial:m177_5 -# 177| valnum = unique # 178| r178_1(glval) = FunctionAddress[add] : # 178| valnum = unique # 178| r178_2(int) = Constant[1] : @@ -1314,13 +1342,9 @@ test.cpp: # 178| valnum = r176_3, r178_3 # 178| r178_4(int) = Call[add] : func:r178_1, 0:r178_2, 1:r178_3 # 178| valnum = r176_4, r178_4 -# 178| m178_5(unknown) = ^CallSideEffect : ~m177_6 -# 178| valnum = unique -# 178| m178_6(unknown) = Chi : total:m177_6, partial:m178_5 -# 178| valnum = unique # 179| v179_1(void) = NoOp : # 165| v165_13(void) = ReturnIndirection[dst] : &:r165_7, m171_11 # 165| v165_14(void) = ReturnIndirection[src] : &:r165_11, m165_12 # 165| v165_15(void) = ReturnVoid : -# 165| v165_16(void) = AliasedUse : ~m178_6 +# 165| v165_16(void) = AliasedUse : m165_3 # 165| v165_17(void) = ExitFunction : diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/test.cpp b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/test.cpp index c3624f7bf20..7ac0b4233be 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/test.cpp +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/test.cpp @@ -160,7 +160,7 @@ void test_read_global_different(int n) { int strlen(const char *str); char *strcat(char *dst, const char *src); -int add(int a, int b); +int add(int a, int b) { return a+b; } void test_func_value_numbering(char *dst, char *src) { int a = strlen(dst);