diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index 2149f148fef2..39d27581ab27 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -362,6 +362,12 @@ predicate ignoreLoad(Expr expr) { or expr instanceof FunctionAccess or + // The load is duplicated from the operand. + expr instanceof ParenthesisExpr + or + // The load is duplicated from the right operand. + expr instanceof CommaExpr + or expr.(PointerDereferenceExpr).getOperand().getFullyConverted().getType().getUnspecifiedType() instanceof FunctionPointerType or diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 4f93f5d37024..9160e212cc28 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -648,19 +648,7 @@ abstract class TranslatedCrementOperation extends TranslatedNonConstantExpr { class TranslatedPrefixCrementOperation extends TranslatedCrementOperation { override PrefixCrementOperation expr; - override Instruction getResult() { - if expr.isPRValueCategory() - then - // If this is C, then the result of a prefix crement is a prvalue for the - // new value assigned to the operand. If this is C++, then the result is - // an lvalue, but that lvalue is being loaded as part of this expression. - // EDG doesn't mark this as a load. - result = this.getInstruction(CrementOpTag()) - else - // This is C++, where the result is an lvalue for the operand, and that - // lvalue is not being loaded as part of this expression. - result = this.getUnloadedOperand().getResult() - } + override Instruction getResult() { result = this.getUnloadedOperand().getResult() } } class TranslatedPostfixCrementOperation extends TranslatedCrementOperation { @@ -1503,19 +1491,7 @@ class TranslatedAssignExpr extends TranslatedNonConstantExpr { result = this.getRightOperand().getFirstInstruction() } - final override Instruction getResult() { - if expr.isPRValueCategory() - then - // If this is C, then the result of an assignment is a prvalue for the new - // value assigned to the left operand. If this is C++, then the result is - // an lvalue, but that lvalue is being loaded as part of this expression. - // EDG doesn't mark this as a load. - result = this.getRightOperand().getResult() - else - // This is C++, where the result is an lvalue for the left operand, - // and that lvalue is not being loaded as part of this expression. - result = this.getLeftOperand().getResult() - } + final override Instruction getResult() { result = this.getLeftOperand().getResult() } final TranslatedExpr getLeftOperand() { result = getTranslatedExpr(expr.getLValue().getFullyConverted()) @@ -1641,19 +1617,7 @@ class TranslatedAssignOperation extends TranslatedNonConstantExpr { result = this.getRightOperand().getFirstInstruction() } - final override Instruction getResult() { - if expr.isPRValueCategory() - then - // If this is C, then the result of an assignment is a prvalue for the new - // value assigned to the left operand. If this is C++, then the result is - // an lvalue, but that lvalue is being loaded as part of this expression. - // EDG doesn't mark this as a load. - result = this.getStoredValue() - else - // This is C++, where the result is an lvalue for the left operand, - // and that lvalue is not being loaded as part of this expression. - result = this.getUnloadedLeftOperand().getResult() - } + final override Instruction getResult() { result = this.getUnloadedLeftOperand().getResult() } final TranslatedExpr getUnloadedLeftOperand() { result = this.getLoadedLeftOperand().getOperand() @@ -2114,8 +2078,15 @@ abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr { not this.elseIsVoid() and tag = ConditionValueFalseStoreTag() ) and opcode instanceof Opcode::Store and - resultType = this.getResultType() + ( + not expr.hasLValueToRValueConversion() and + resultType = this.getResultType() + or + expr.hasLValueToRValueConversion() and + resultType = getTypeForPRValue(expr.getType()) + ) or + not expr.hasLValueToRValueConversion() and tag = ConditionValueResultLoadTag() and opcode instanceof Opcode::Load and resultType = this.getResultType() @@ -2145,8 +2116,15 @@ abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr { ) or tag = ConditionValueResultTempAddressTag() and - result = this.getInstruction(ConditionValueResultLoadTag()) + ( + not expr.hasLValueToRValueConversion() and + result = this.getInstruction(ConditionValueResultLoadTag()) + or + expr.hasLValueToRValueConversion() and + result = this.getParent().getChildSuccessor(this) + ) or + not expr.hasLValueToRValueConversion() and tag = ConditionValueResultLoadTag() and result = this.getParent().getChildSuccessor(this) ) @@ -2175,18 +2153,23 @@ abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr { result = this.getElse().getResult() ) or + not expr.hasLValueToRValueConversion() and tag = ConditionValueResultLoadTag() and - ( - operandTag instanceof AddressOperandTag and - result = this.getInstruction(ConditionValueResultTempAddressTag()) - ) + operandTag instanceof AddressOperandTag and + result = this.getInstruction(ConditionValueResultTempAddressTag()) ) } final override predicate hasTempVariable(TempVariableTag tag, CppType type) { not this.resultIsVoid() and tag = ConditionValueTempVar() and - type = this.getResultType() + ( + not expr.hasLValueToRValueConversion() and + type = this.getResultType() + or + expr.hasLValueToRValueConversion() and + type = getTypeForPRValue(expr.getType()) + ) } final override IRVariable getInstructionVariable(InstructionTag tag) { @@ -2201,7 +2184,13 @@ abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr { final override Instruction getResult() { not this.resultIsVoid() and - result = this.getInstruction(ConditionValueResultLoadTag()) + ( + expr.hasLValueToRValueConversion() and + result = this.getInstruction(ConditionValueResultTempAddressTag()) + or + not expr.hasLValueToRValueConversion() and + result = this.getInstruction(ConditionValueResultLoadTag()) + ) } override Instruction getChildSuccessor(TranslatedElement child) { @@ -3232,11 +3221,9 @@ predicate exprNeedsCopyIfNotLoaded(Expr expr) { ( expr instanceof AssignExpr or - expr instanceof AssignOperation and - not expr.isPRValueCategory() // is C++ + expr instanceof AssignOperation or - expr instanceof PrefixCrementOperation and - not expr.isPRValueCategory() // is C++ + expr instanceof PrefixCrementOperation or // Because the load is on the `e` in `e++`. expr instanceof PostfixCrementOperation diff --git a/cpp/ql/test/examples/expressions/PrintAST.expected b/cpp/ql/test/examples/expressions/PrintAST.expected index 8de5ea5b9b0f..511a4d55c154 100644 --- a/cpp/ql/test/examples/expressions/PrintAST.expected +++ b/cpp/ql/test/examples/expressions/PrintAST.expected @@ -763,7 +763,7 @@ StaticMemberAccess.cpp: # 7| ValueCategory = lvalue # 7| getRValue(): [VariableAccess] i # 7| Type = [IntType] int -# 7| ValueCategory = prvalue +# 7| ValueCategory = prvalue(load) # 7| getQualifier(): [VariableAccess] xref # 7| Type = [LValueReferenceType] X & # 7| ValueCategory = prvalue(load) @@ -1394,7 +1394,7 @@ union_etc.cpp: # 26| ValueCategory = lvalue # 26| getRValue(): [AssignExpr] ... = ... # 26| Type = [IntType] int -# 26| ValueCategory = prvalue +# 26| ValueCategory = prvalue(load) # 26| getLValue(): [ValueFieldAccess] e # 26| Type = [IntType] int # 26| ValueCategory = lvalue @@ -1406,7 +1406,7 @@ union_etc.cpp: # 26| ValueCategory = lvalue # 26| getRValue(): [AssignExpr] ... = ... # 26| Type = [IntType] int -# 26| ValueCategory = prvalue +# 26| ValueCategory = prvalue(load) # 26| getLValue(): [ValueFieldAccess] i # 26| Type = [IntType] int # 26| ValueCategory = lvalue diff --git a/cpp/ql/test/experimental/library-tests/rangeanalysis/signanalysis/SignAnalysis.expected b/cpp/ql/test/experimental/library-tests/rangeanalysis/signanalysis/SignAnalysis.expected index 438bc9173f22..7a73b0dabebc 100644 --- a/cpp/ql/test/experimental/library-tests/rangeanalysis/signanalysis/SignAnalysis.expected +++ b/cpp/ql/test/experimental/library-tests/rangeanalysis/signanalysis/SignAnalysis.expected @@ -675,6 +675,7 @@ | test.c:398:9:398:22 | CopyValue: ... , ... | positive strictlyPositive | | test.c:398:14:398:14 | Load: y | positive strictlyPositive | | test.c:398:14:398:19 | Add: ... += ... | positive strictlyPositive | +| test.c:398:14:398:19 | Load: ... += ... | positive strictlyPositive | | test.c:398:14:398:19 | Store: ... += ... | positive strictlyPositive | | test.c:398:19:398:19 | Constant: (unsigned int)... | positive strictlyPositive | | test.c:398:22:398:22 | Load: y | positive strictlyPositive | diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected index b5bbc68dbd4d..147933c2b230 100644 --- a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected +++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected @@ -35,6 +35,7 @@ edges | test.cpp:136:9:136:16 | ... += ... | test.cpp:138:13:138:15 | arr | | test.cpp:143:18:143:21 | asdf | test.cpp:134:25:134:27 | arr | | test.cpp:143:18:143:21 | asdf | test.cpp:143:18:143:21 | asdf | +| test.cpp:146:26:146:26 | p indirection | test.cpp:147:4:147:9 | -- ... | | test.cpp:146:26:146:26 | p indirection | test.cpp:148:6:148:9 | * ... | | test.cpp:156:12:156:14 | buf | test.cpp:156:12:156:18 | ... + ... | | test.cpp:156:12:156:18 | ... + ... | test.cpp:158:17:158:18 | & ... indirection | @@ -122,6 +123,7 @@ nodes | test.cpp:143:18:143:21 | asdf | semmle.label | asdf | | test.cpp:143:18:143:21 | asdf | semmle.label | asdf | | test.cpp:146:26:146:26 | p indirection | semmle.label | p indirection | +| test.cpp:147:4:147:9 | -- ... | semmle.label | -- ... | | test.cpp:148:6:148:9 | * ... | semmle.label | * ... | | test.cpp:156:12:156:14 | buf | semmle.label | buf | | test.cpp:156:12:156:18 | ... + ... | semmle.label | ... + ... | @@ -175,6 +177,7 @@ subpaths | test.cpp:88:5:88:27 | PointerAdd: access to array | test.cpp:85:34:85:36 | buf | test.cpp:88:5:88:27 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:88:5:88:31 | Store: ... = ... | write | | test.cpp:128:9:128:14 | PointerAdd: access to array | test.cpp:128:9:128:11 | arr | test.cpp:128:9:128:14 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:125:11:125:13 | arr | arr | test.cpp:128:9:128:18 | Store: ... = ... | write | | test.cpp:136:9:136:16 | PointerAdd: ... += ... | test.cpp:143:18:143:21 | asdf | test.cpp:138:13:138:15 | arr | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:142:10:142:13 | asdf | asdf | test.cpp:138:12:138:15 | Load: * ... | read | +| test.cpp:156:12:156:18 | PointerAdd: ... + ... | test.cpp:156:12:156:14 | buf | test.cpp:147:4:147:9 | -- ... | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:154:7:154:9 | buf | buf | test.cpp:147:3:147:13 | Store: ... = ... | write | | test.cpp:156:12:156:18 | PointerAdd: ... + ... | test.cpp:156:12:156:14 | buf | test.cpp:148:6:148:9 | * ... | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:154:7:154:9 | buf | buf | test.cpp:147:3:147:13 | Store: ... = ... | write | | test.cpp:221:5:221:11 | PointerAdd: access to array | test.cpp:218:23:218:28 | buffer | test.cpp:221:5:221:11 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:217:19:217:24 | buffer | buffer | test.cpp:221:5:221:15 | Store: ... = ... | write | | test.cpp:232:5:232:10 | PointerAdd: access to array | test.cpp:229:25:229:29 | array | test.cpp:232:5:232:10 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:228:10:228:14 | array | array | test.cpp:232:5:232:19 | Store: ... = ... | write | diff --git a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang421.c b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang421.c index 43e489fdffb8..3c772b3be229 100644 --- a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang421.c +++ b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang421.c @@ -1,2 +1,2 @@ static int clang421 = __has_feature(attribute_deprecated_with_message); -// semmle-extractor-options: --gnu_version 40201 --edg --clang +// semmle-extractor-options: --gnu_version 40201 --clang_version 30400 diff --git a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang450.c b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang450.c index 80b0a5a8711c..8c43f17d7183 100644 --- a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang450.c +++ b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/clang450.c @@ -1,2 +1,2 @@ static int clang450 = __has_feature(attribute_deprecated_with_message); -// semmle-extractor-options: --gnu_version 40500 --edg --clang +// semmle-extractor-options: --gnu_version 40500 --clang_version 30500 diff --git a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc421.c b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc421.c index 25ca6a4f694c..7f4e4f4d380b 100644 --- a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc421.c +++ b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc421.c @@ -1,2 +1,2 @@ static int gcc421 = __has_feature(attribute_deprecated_with_message); -// semmle-extractor-options: --gnu_version 40201 --edg --clang +// semmle-extractor-options: --gnu_version 40201 diff --git a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc450.c b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc450.c index e10dd05dfc85..a49c88651638 100644 --- a/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc450.c +++ b/cpp/ql/test/library-tests/attributes/deprecated_with_msg/gcc450.c @@ -1,2 +1,2 @@ static int gcc450 = __has_feature(attribute_deprecated_with_message); -// semmle-extractor-options: --gnu_version 40500 --edg --clang +// semmle-extractor-options: --gnu_version 40500 diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected index 58049de095de..eadf03fca62c 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected @@ -15,6 +15,7 @@ localCallNodes postIsNotPre postHasUniquePre uniquePostUpdate +| example.c:24:13:24:18 | coords indirection | Node has multiple PostUpdateNodes. | postIsInSameCallable reverseRead argHasPostUpdate diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 5de871e4c68c..bb719e53918d 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -1761,7 +1761,7 @@ ir.c: # 9| ValueCategory = lvalue # 9| getRValue(): [AssignExpr] ... = ... # 9| Type = [IntType] int -# 9| ValueCategory = prvalue +# 9| ValueCategory = prvalue(load) # 9| getLValue(): [ValueFieldAccess] y # 9| Type = [IntType] int # 9| ValueCategory = lvalue @@ -2675,7 +2675,7 @@ ir.cpp: # 101| ValueCategory = lvalue # 101| getRValue(): [PrefixIncrExpr] ++ ... # 101| Type = [IntType] int -# 101| ValueCategory = prvalue +# 101| ValueCategory = prvalue(load) # 101| getOperand(): [VariableAccess] x # 101| Type = [IntType] int # 101| ValueCategory = lvalue @@ -2688,7 +2688,7 @@ ir.cpp: # 102| ValueCategory = lvalue # 102| getRValue(): [PrefixDecrExpr] -- ... # 102| Type = [IntType] int -# 102| ValueCategory = prvalue +# 102| ValueCategory = prvalue(load) # 102| getOperand(): [VariableAccess] x # 102| Type = [IntType] int # 102| ValueCategory = lvalue @@ -3041,7 +3041,7 @@ ir.cpp: # 147| ValueCategory = lvalue # 147| getRValue(): [PrefixIncrExpr] ++ ... # 147| Type = [FloatType] float -# 147| ValueCategory = prvalue +# 147| ValueCategory = prvalue(load) # 147| getOperand(): [VariableAccess] x # 147| Type = [FloatType] float # 147| ValueCategory = lvalue @@ -3054,7 +3054,7 @@ ir.cpp: # 148| ValueCategory = lvalue # 148| getRValue(): [PrefixDecrExpr] -- ... # 148| Type = [FloatType] float -# 148| ValueCategory = prvalue +# 148| ValueCategory = prvalue(load) # 148| getOperand(): [VariableAccess] x # 148| Type = [FloatType] float # 148| ValueCategory = lvalue @@ -3557,7 +3557,7 @@ ir.cpp: # 207| ValueCategory = lvalue # 207| getRValue(): [PrefixIncrExpr] ++ ... # 207| Type = [IntPointerType] int * -# 207| ValueCategory = prvalue +# 207| ValueCategory = prvalue(load) # 207| getOperand(): [VariableAccess] p # 207| Type = [IntPointerType] int * # 207| ValueCategory = lvalue @@ -3570,7 +3570,7 @@ ir.cpp: # 208| ValueCategory = lvalue # 208| getRValue(): [PrefixDecrExpr] -- ... # 208| Type = [IntPointerType] int * -# 208| ValueCategory = prvalue +# 208| ValueCategory = prvalue(load) # 208| getOperand(): [VariableAccess] p # 208| Type = [IntPointerType] int * # 208| ValueCategory = lvalue @@ -4825,7 +4825,7 @@ ir.cpp: # 483| getVariable().getInitializer(): [Initializer] initializer for z # 483| getExpr(): [ConditionalExpr] ... ? ... : ... # 483| Type = [IntType] int -# 483| ValueCategory = prvalue +# 483| ValueCategory = prvalue(load) # 483| getCondition(): [VariableAccess] a # 483| Type = [BoolType] bool # 483| ValueCategory = prvalue(load) @@ -6025,7 +6025,7 @@ ir.cpp: # 705| getStmt(0): [ReturnStmt] return ... # 705| getExpr(): [ConditionalExpr] ... ? ... : ... # 705| Type = [UnknownType] unknown -# 705| ValueCategory = prvalue(load) +# 705| ValueCategory = prvalue # 705| getCondition(): [LTExpr] ... < ... # 705| Type = [UnknownType] unknown # 705| ValueCategory = prvalue @@ -6058,7 +6058,7 @@ ir.cpp: # 705| getStmt(0): [ReturnStmt] return ... # 705| getExpr(): [ConditionalExpr] ... ? ... : ... # 705| Type = [IntType] int -# 705| ValueCategory = prvalue +# 705| ValueCategory = prvalue(load) # 705| getCondition(): [LTExpr] ... < ... # 705| Type = [BoolType] bool # 705| ValueCategory = prvalue @@ -7864,7 +7864,7 @@ ir.cpp: # 915| getVariable().getInitializer(): [Initializer] initializer for b # 915| getExpr(): [ConditionalExpr] ... ? ... : ... # 915| Type = [IntType] int -# 915| ValueCategory = prvalue +# 915| ValueCategory = prvalue(load) # 915| getCondition(): [Literal] 1 # 915| Type = [BoolType] bool # 915| Value = [Literal] 1 @@ -8633,6 +8633,9 @@ ir.cpp: # 1038| : #-----| getParameter(0): [Parameter] (unnamed parameter 0) #-----| Type = [RValueReferenceType] lambda [] type at line 1038, col. 12 && +# 1038| : +# 1038| getEntryPoint(): [BlockStmt] { ... } +# 1038| getStmt(0): [ReturnStmt] return ... # 1038| [Constructor] void (lambda [] type at line 1038, col. 12)::(unnamed constructor)() # 1038| : # 1038| [MemberFunction] void (lambda [] type at line 1038, col. 12)::_FUN() @@ -8963,6 +8966,9 @@ ir.cpp: # 1041| : #-----| getParameter(0): [Parameter] (unnamed parameter 0) #-----| Type = [RValueReferenceType] lambda [] type at line 1041, col. 23 && +# 1041| : +# 1041| getEntryPoint(): [BlockStmt] { ... } +# 1041| getStmt(0): [ReturnStmt] return ... # 1041| [Constructor] void (void Lambda(int, String const&))::(lambda [] type at line 1041, col. 23)::(unnamed constructor)() # 1041| : # 1041| [MemberFunction] char (void Lambda(int, String const&))::(lambda [] type at line 1041, col. 23)::_FUN(float) @@ -10456,7 +10462,7 @@ ir.cpp: # 1301| ValueCategory = lvalue # 1301| getRValue(): [ConditionalExpr] ... ? ... : ... # 1301| Type = [IntType] int -# 1301| ValueCategory = prvalue +# 1301| ValueCategory = prvalue(load) # 1301| getCondition(): [VariableAccess] b # 1301| Type = [BoolType] bool # 1301| ValueCategory = prvalue(load) @@ -10472,7 +10478,7 @@ ir.cpp: # 1302| ValueCategory = lvalue # 1302| getRValue(): [ConditionalExpr] ... ? ... : ... # 1302| Type = [LongType] long -# 1302| ValueCategory = prvalue +# 1302| ValueCategory = prvalue(load) # 1302| getCondition(): [VariableAccess] b # 1302| Type = [BoolType] bool # 1302| ValueCategory = prvalue(load) @@ -10492,7 +10498,7 @@ ir.cpp: # 1303| ValueCategory = lvalue # 1303| getRValue(): [ConditionalExpr] ... ? ... : ... # 1303| Type = [IntType] int -# 1303| ValueCategory = prvalue +# 1303| ValueCategory = prvalue(load) # 1303| getCondition(): [VariableAccess] x # 1303| Type = [IntType] int # 1303| ValueCategory = prvalue(load) @@ -10512,7 +10518,7 @@ ir.cpp: # 1304| ValueCategory = lvalue # 1304| getRValue(): [ConditionalExpr] ... ? ... : ... # 1304| Type = [LongType] long -# 1304| ValueCategory = prvalue +# 1304| ValueCategory = prvalue(load) # 1304| getCondition(): [VariableAccess] x # 1304| Type = [IntType] int # 1304| ValueCategory = prvalue(load) @@ -10536,7 +10542,7 @@ ir.cpp: # 1305| ValueCategory = lvalue # 1305| getRValue(): [ConditionalExpr] ... ? ... : ... # 1305| Type = [LongType] long -# 1305| ValueCategory = prvalue +# 1305| ValueCategory = prvalue(load) # 1305| getCondition(): [VariableAccess] y # 1305| Type = [LongType] long # 1305| ValueCategory = prvalue(load) @@ -10564,7 +10570,7 @@ ir.cpp: # 1306| ValueCategory = lvalue # 1306| getRValue(): [ConditionalExpr] ... ? ... : ... # 1306| Type = [LongType] long -# 1306| ValueCategory = prvalue +# 1306| ValueCategory = prvalue(load) # 1306| getCondition(): [VariableAccess] y # 1306| Type = [LongType] long # 1306| ValueCategory = prvalue(load) @@ -10588,7 +10594,7 @@ ir.cpp: # 1308| ValueCategory = lvalue # 1308| getRValue(): [ConditionalExpr] ... ? ... : ... # 1308| Type = [IntType] int -# 1308| ValueCategory = prvalue +# 1308| ValueCategory = prvalue(load) # 1308| getCondition(): [LogicalOrExpr] ... || ... # 1308| Type = [BoolType] bool # 1308| ValueCategory = prvalue @@ -10633,7 +10639,7 @@ ir.cpp: # 1315| getStmt(0): [ReturnStmt] return ... # 1315| getExpr(): [ConditionalExpr] ... ? ... : ... # 1315| Type = [IntType] int -# 1315| ValueCategory = prvalue +# 1315| ValueCategory = prvalue(load) # 1315| getCondition(): [LogicalAndExpr] ... && ... # 1315| Type = [BoolType] bool # 1315| ValueCategory = prvalue @@ -10949,7 +10955,7 @@ ir.cpp: # 1376| ValueCategory = prvalue # 1376| getExpr().getFullyConverted(): [TemporaryObjectExpr] temporary object # 1376| Type = [Struct] String -# 1376| ValueCategory = prvalue(load) +# 1376| ValueCategory = prvalue # 1377| getStmt(9): [ReturnStmt] return ... # 1379| [TopLevelFunction] void temporary_destructor_only() # 1379| : @@ -11032,7 +11038,7 @@ ir.cpp: # 1388| ValueCategory = prvalue # 1388| getExpr().getFullyConverted(): [TemporaryObjectExpr] temporary object # 1388| Type = [Class] destructor_only -# 1388| ValueCategory = prvalue(load) +# 1388| ValueCategory = prvalue # 1389| getStmt(8): [ReturnStmt] return ... # 1391| [TopLevelFunction] void temporary_copy_constructor() # 1391| : @@ -11128,7 +11134,7 @@ ir.cpp: # 1399| ValueCategory = prvalue # 1399| getExpr().getFullyConverted(): [TemporaryObjectExpr] temporary object # 1399| Type = [Class] copy_constructor -# 1399| ValueCategory = prvalue(load) +# 1399| ValueCategory = prvalue # 1401| getStmt(8): [DeclStmt] declaration # 1401| getDeclarationEntry(0): [VariableDeclarationEntry] definition of y # 1401| Type = [IntType] int @@ -13368,9 +13374,6 @@ ir.cpp: # 1714| getExpr(): [TemporaryObjectExpr] temporary object # 1714| Type = [Class] TrivialLambdaClass # 1714| ValueCategory = lvalue -# 1714| getExpr(): [TemporaryObjectExpr] temporary object -# 1714| Type = [Class] TrivialLambdaClass -# 1714| ValueCategory = prvalue(load) # 1716| getStmt(2): [DeclStmt] declaration # 1716| getDeclarationEntry(0): [VariableDeclarationEntry] definition of l_outer1 # 1716| Type = [Closure,LocalClass] decltype([...](...){...}) @@ -14710,7 +14713,7 @@ ir.cpp: # 1930| ValueCategory = lvalue # 1930| getRValue(): [AssignExpr] ... = ... # 1930| Type = [IntType] int -# 1930| ValueCategory = prvalue +# 1930| ValueCategory = prvalue(load) # 1930| getLValue(): [VariableAccess] j # 1930| Type = [IntType] int # 1930| ValueCategory = lvalue @@ -14741,7 +14744,7 @@ ir.cpp: # 1935| ValueCategory = lvalue # 1935| getRValue(): [AssignAddExpr] ... += ... # 1935| Type = [IntType] int -# 1935| ValueCategory = prvalue +# 1935| ValueCategory = prvalue(load) # 1935| getLValue(): [VariableAccess] j # 1935| Type = [IntType] int # 1935| ValueCategory = lvalue @@ -14751,7 +14754,7 @@ ir.cpp: # 1935| ValueCategory = prvalue # 1935| getRValue().getFullyConverted(): [ParenthesisExpr] (...) # 1935| Type = [IntType] int -# 1935| ValueCategory = prvalue +# 1935| ValueCategory = prvalue(load) # 1936| getStmt(2): [ReturnStmt] return ... # 1938| [CopyAssignmentOperator] D& D::operator=(D const&) # 1938| : @@ -15040,7 +15043,7 @@ ir.cpp: # 1993| ValueCategory = lvalue # 1993| getRValue(): [FunctionAccess] StaticMemberFunction # 1993| Type = [FunctionPointerType] ..(*)(..) -# 1993| ValueCategory = prvalue +# 1993| ValueCategory = prvalue(load) # 1993| getQualifier(): [VariableAccess] c # 1993| Type = [Class] C # 1993| ValueCategory = lvalue @@ -15065,7 +15068,7 @@ ir.cpp: # 1997| ValueCategory = lvalue # 1997| getRValue(): [ConditionalExpr] ... ? ... : ... # 1997| Type = [IntType] int -# 1997| ValueCategory = prvalue +# 1997| ValueCategory = prvalue(load) # 1997| getCondition(): [VariableAccess] a # 1997| Type = [BoolType] bool # 1997| ValueCategory = prvalue(load) @@ -15084,7 +15087,7 @@ ir.cpp: # 1998| ValueCategory = lvalue # 1998| getRValue(): [ConditionalExpr] ... ? ... : ... # 1998| Type = [IntType] int -# 1998| ValueCategory = prvalue +# 1998| ValueCategory = prvalue(load) # 1998| getCondition(): [VariableAccess] a # 1998| Type = [BoolType] bool # 1998| ValueCategory = prvalue(load) @@ -15168,7 +15171,7 @@ ir.cpp: # 2007| ValueCategory = lvalue # 2007| getRValue(): [ConditionalExpr] ... ? ... : ... # 2007| Type = [Struct] TernaryPodObj -# 2007| ValueCategory = prvalue +# 2007| ValueCategory = prvalue(load) # 2007| getCondition(): [VariableAccess] a # 2007| Type = [BoolType] bool # 2007| ValueCategory = prvalue(load) @@ -15249,7 +15252,7 @@ ir.cpp: # 2010| ValueCategory = lvalue # 2010| getRValue(): [ConditionalExpr] ... ? ... : ... # 2010| Type = [Struct] TernaryPodObj -# 2010| ValueCategory = prvalue +# 2010| ValueCategory = prvalue(load) # 2010| getCondition(): [VariableAccess] a # 2010| Type = [BoolType] bool # 2010| ValueCategory = prvalue(load) @@ -15501,7 +15504,7 @@ ir.cpp: # 2028| ValueCategory = lvalue # 2028| getRValue(): [ConditionalExpr] ... ? ... : ... # 2028| Type = [IntType] unsigned int -# 2028| ValueCategory = prvalue +# 2028| ValueCategory = prvalue(load) # 2028| getCondition(): [LTExpr] ... < ... # 2028| Type = [BoolType] bool # 2028| ValueCategory = prvalue @@ -15519,7 +15522,7 @@ ir.cpp: # 2028| ValueCategory = prvalue # 2029| getThen(): [CommaExpr] ... , ... # 2029| Type = [IntType] unsigned int -# 2029| ValueCategory = prvalue +# 2029| ValueCategory = prvalue(load) # 2029| getLeftOperand(): [FunctionCall] call to CommaTestHelper # 2029| Type = [VoidType] void # 2029| ValueCategory = prvalue @@ -15544,7 +15547,7 @@ ir.cpp: # 2030| ValueCategory = prvalue # 2029| getThen().getFullyConverted(): [ParenthesisExpr] (...) # 2029| Type = [IntType] unsigned int -# 2029| ValueCategory = prvalue +# 2029| ValueCategory = prvalue(load) # 2030| getElse().getFullyConverted(): [CStyleCast] (unsigned int)... # 2030| Conversion = [IntegralConversion] integral conversion # 2030| Type = [IntType] unsigned int diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index bfe31bbefe7a..84d864f13b1e 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -684,6 +684,10 @@ | file://:0:0:0:0 | Address | &:r0_1 | | file://:0:0:0:0 | Address | &:r0_1 | | file://:0:0:0:0 | Address | &:r0_1 | +| file://:0:0:0:0 | Address | &:r0_1 | +| file://:0:0:0:0 | Address | &:r0_1 | +| file://:0:0:0:0 | Address | &:r0_1 | +| file://:0:0:0:0 | Address | &:r0_1 | | file://:0:0:0:0 | Address | &:r0_2 | | file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_3 | @@ -712,6 +716,10 @@ | file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_4 | | file://:0:0:0:0 | Address | &:r0_4 | | file://:0:0:0:0 | Address | &:r0_5 | @@ -811,6 +819,8 @@ | file://:0:0:0:0 | Load | m0_2 | | file://:0:0:0:0 | Load | m0_2 | | file://:0:0:0:0 | Load | m0_2 | +| file://:0:0:0:0 | Load | m0_2 | +| file://:0:0:0:0 | Load | m0_2 | | file://:0:0:0:0 | Load | m0_5 | | file://:0:0:0:0 | Load | m0_8 | | file://:0:0:0:0 | Load | m0_11 | @@ -822,7 +832,7 @@ | file://:0:0:0:0 | Load | m1466_4 | | file://:0:0:0:0 | Load | m1466_4 | | file://:0:0:0:0 | Load | m1685_9 | -| file://:0:0:0:0 | Load | m1714_7 | +| file://:0:0:0:0 | Load | m1714_4 | | file://:0:0:0:0 | Load | m1834_6 | | file://:0:0:0:0 | Load | m1834_6 | | file://:0:0:0:0 | Load | m1839_6 | @@ -847,6 +857,8 @@ | file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_4 | +| file://:0:0:0:0 | SideEffect | m0_4 | +| file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_14 | | file://:0:0:0:0 | SideEffect | m1078_23 | | file://:0:0:0:0 | SideEffect | m1078_23 | @@ -954,13 +966,14 @@ | ir.c:9:14:9:19 | Unary | r9_5 | | ir.c:9:14:9:31 | ChiPartial | partial:m9_7 | | ir.c:9:14:9:31 | ChiTotal | total:m8_10 | +| ir.c:9:14:9:31 | Load | m9_7 | | ir.c:9:14:9:31 | StoreValue | r9_9 | | ir.c:9:21:9:21 | Address | &:r9_6 | +| ir.c:9:21:9:21 | Address | &:r9_6 | | ir.c:9:25:9:27 | Address | &:r9_1 | | ir.c:9:25:9:27 | Left | r9_2 | | ir.c:9:25:9:27 | Load | m7_6 | | ir.c:9:25:9:31 | StoreValue | r9_4 | -| ir.c:9:25:9:31 | Unary | r9_4 | | ir.c:9:31:9:31 | Right | r9_3 | | ir.c:10:3:10:8 | Unary | r10_10 | | ir.c:10:3:10:26 | ChiPartial | partial:m10_12 | @@ -1329,18 +1342,22 @@ | ir.cpp:98:6:98:19 | SideEffect | m98_3 | | ir.cpp:98:25:98:25 | Address | &:r98_5 | | ir.cpp:99:9:99:9 | Address | &:r99_1 | -| ir.cpp:101:5:101:5 | Address | &:r101_6 | +| ir.cpp:101:5:101:5 | Address | &:r101_7 | +| ir.cpp:101:9:101:11 | Load | m101_5 | | ir.cpp:101:9:101:11 | Right | r101_3 | | ir.cpp:101:9:101:11 | StoreValue | r101_4 | -| ir.cpp:101:9:101:11 | StoreValue | r101_4 | +| ir.cpp:101:9:101:11 | StoreValue | r101_6 | +| ir.cpp:101:11:101:11 | Address | &:r101_1 | | ir.cpp:101:11:101:11 | Address | &:r101_1 | | ir.cpp:101:11:101:11 | Address | &:r101_1 | | ir.cpp:101:11:101:11 | Left | r101_2 | | ir.cpp:101:11:101:11 | Load | m98_6 | -| ir.cpp:102:5:102:5 | Address | &:r102_6 | +| ir.cpp:102:5:102:5 | Address | &:r102_7 | +| ir.cpp:102:9:102:11 | Load | m102_5 | | ir.cpp:102:9:102:11 | Right | r102_3 | | ir.cpp:102:9:102:11 | StoreValue | r102_4 | -| ir.cpp:102:9:102:11 | StoreValue | r102_4 | +| ir.cpp:102:9:102:11 | StoreValue | r102_6 | +| ir.cpp:102:11:102:11 | Address | &:r102_1 | | ir.cpp:102:11:102:11 | Address | &:r102_1 | | ir.cpp:102:11:102:11 | Address | &:r102_1 | | ir.cpp:102:11:102:11 | Left | r102_2 | @@ -1531,18 +1548,22 @@ | ir.cpp:144:6:144:17 | SideEffect | m144_3 | | ir.cpp:144:25:144:25 | Address | &:r144_5 | | ir.cpp:145:11:145:11 | Address | &:r145_1 | -| ir.cpp:147:5:147:5 | Address | &:r147_6 | +| ir.cpp:147:5:147:5 | Address | &:r147_7 | +| ir.cpp:147:9:147:11 | Load | m147_5 | | ir.cpp:147:9:147:11 | Right | r147_3 | | ir.cpp:147:9:147:11 | StoreValue | r147_4 | -| ir.cpp:147:9:147:11 | StoreValue | r147_4 | +| ir.cpp:147:9:147:11 | StoreValue | r147_6 | +| ir.cpp:147:11:147:11 | Address | &:r147_1 | | ir.cpp:147:11:147:11 | Address | &:r147_1 | | ir.cpp:147:11:147:11 | Address | &:r147_1 | | ir.cpp:147:11:147:11 | Left | r147_2 | | ir.cpp:147:11:147:11 | Load | m144_6 | -| ir.cpp:148:5:148:5 | Address | &:r148_6 | +| ir.cpp:148:5:148:5 | Address | &:r148_7 | +| ir.cpp:148:9:148:11 | Load | m148_5 | | ir.cpp:148:9:148:11 | Right | r148_3 | | ir.cpp:148:9:148:11 | StoreValue | r148_4 | -| ir.cpp:148:9:148:11 | StoreValue | r148_4 | +| ir.cpp:148:9:148:11 | StoreValue | r148_6 | +| ir.cpp:148:11:148:11 | Address | &:r148_1 | | ir.cpp:148:11:148:11 | Address | &:r148_1 | | ir.cpp:148:11:148:11 | Address | &:r148_1 | | ir.cpp:148:11:148:11 | Left | r148_2 | @@ -1840,18 +1861,22 @@ | ir.cpp:204:26:204:26 | Load | m204_6 | | ir.cpp:204:26:204:26 | SideEffect | m204_8 | | ir.cpp:205:10:205:10 | Address | &:r205_1 | -| ir.cpp:207:5:207:5 | Address | &:r207_6 | +| ir.cpp:207:5:207:5 | Address | &:r207_7 | +| ir.cpp:207:9:207:11 | Load | m207_5 | | ir.cpp:207:9:207:11 | Right | r207_3 | | ir.cpp:207:9:207:11 | StoreValue | r207_4 | -| ir.cpp:207:9:207:11 | StoreValue | r207_4 | +| ir.cpp:207:9:207:11 | StoreValue | r207_6 | +| ir.cpp:207:11:207:11 | Address | &:r207_1 | | ir.cpp:207:11:207:11 | Address | &:r207_1 | | ir.cpp:207:11:207:11 | Address | &:r207_1 | | ir.cpp:207:11:207:11 | Left | r207_2 | | ir.cpp:207:11:207:11 | Load | m204_6 | -| ir.cpp:208:5:208:5 | Address | &:r208_6 | +| ir.cpp:208:5:208:5 | Address | &:r208_7 | +| ir.cpp:208:9:208:11 | Load | m208_5 | | ir.cpp:208:9:208:11 | Right | r208_3 | | ir.cpp:208:9:208:11 | StoreValue | r208_4 | -| ir.cpp:208:9:208:11 | StoreValue | r208_4 | +| ir.cpp:208:9:208:11 | StoreValue | r208_6 | +| ir.cpp:208:11:208:11 | Address | &:r208_1 | | ir.cpp:208:11:208:11 | Address | &:r208_1 | | ir.cpp:208:11:208:11 | Address | &:r208_1 | | ir.cpp:208:11:208:11 | Left | r208_2 | @@ -4897,6 +4922,15 @@ | ir.cpp:1035:15:1035:15 | Address | &:r1035_1 | | ir.cpp:1038:6:1038:8 | Address | &:r1038_3 | | ir.cpp:1038:6:1038:8 | SideEffect | ~m1038_8 | +| ir.cpp:1038:12:1038:12 | Address | &:r1038_5 | +| ir.cpp:1038:12:1038:12 | Address | &:r1038_5 | +| ir.cpp:1038:12:1038:12 | Address | &:r1038_7 | +| ir.cpp:1038:12:1038:12 | Address | &:r1038_7 | +| ir.cpp:1038:12:1038:12 | ChiPartial | partial:m1038_3 | +| ir.cpp:1038:12:1038:12 | ChiTotal | total:m1038_2 | +| ir.cpp:1038:12:1038:12 | Load | m1038_6 | +| ir.cpp:1038:12:1038:12 | SideEffect | m1038_3 | +| ir.cpp:1038:12:1038:12 | SideEffect | m1038_8 | | ir.cpp:1038:12:1038:18 | Address | &:r1038_4 | | ir.cpp:1038:12:1038:18 | Address | &:r1038_4 | | ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_7 | @@ -4936,6 +4970,15 @@ | ir.cpp:1040:34:1040:34 | Load | m1040_8 | | ir.cpp:1040:34:1040:34 | SideEffect | m1040_10 | | ir.cpp:1041:8:1041:19 | Address | &:r1041_1 | +| ir.cpp:1041:23:1041:23 | Address | &:r1041_5 | +| ir.cpp:1041:23:1041:23 | Address | &:r1041_5 | +| ir.cpp:1041:23:1041:23 | Address | &:r1041_7 | +| ir.cpp:1041:23:1041:23 | Address | &:r1041_7 | +| ir.cpp:1041:23:1041:23 | ChiPartial | partial:m1041_3 | +| ir.cpp:1041:23:1041:23 | ChiTotal | total:m1041_2 | +| ir.cpp:1041:23:1041:23 | Load | m1041_6 | +| ir.cpp:1041:23:1041:23 | SideEffect | m1041_3 | +| ir.cpp:1041:23:1041:23 | SideEffect | m1041_8 | | ir.cpp:1041:23:1041:49 | Address | &:r1041_2 | | ir.cpp:1041:23:1041:49 | Address | &:r1041_2 | | ir.cpp:1041:23:1041:49 | Load | m1041_3 | @@ -6557,8 +6600,6 @@ | ir.cpp:1376:5:1376:28 | SideEffect | ~m1374_11 | | ir.cpp:1376:5:1376:28 | StoreValue | r1376_3 | | ir.cpp:1376:5:1376:30 | Address | &:r1376_1 | -| ir.cpp:1376:5:1376:30 | Address | &:r1376_1 | -| ir.cpp:1376:5:1376:30 | Load | m1376_6 | | ir.cpp:1379:6:1379:30 | ChiPartial | partial:m1379_3 | | ir.cpp:1379:6:1379:30 | ChiTotal | total:m1379_2 | | ir.cpp:1379:6:1379:30 | SideEffect | ~m1388_5 | @@ -6633,8 +6674,6 @@ | ir.cpp:1388:5:1388:37 | SideEffect | ~m1386_10 | | ir.cpp:1388:5:1388:37 | StoreValue | r1388_3 | | ir.cpp:1388:5:1388:39 | Address | &:r1388_1 | -| ir.cpp:1388:5:1388:39 | Address | &:r1388_1 | -| ir.cpp:1388:5:1388:39 | Load | m1388_6 | | ir.cpp:1391:6:1391:31 | ChiPartial | partial:m1391_3 | | ir.cpp:1391:6:1391:31 | ChiTotal | total:m1391_2 | | ir.cpp:1391:6:1391:31 | SideEffect | ~m1401_6 | @@ -6734,8 +6773,6 @@ | ir.cpp:1399:5:1399:38 | SideEffect | ~m1398_10 | | ir.cpp:1399:5:1399:38 | StoreValue | r1399_3 | | ir.cpp:1399:5:1399:40 | Address | &:r1399_1 | -| ir.cpp:1399:5:1399:40 | Address | &:r1399_1 | -| ir.cpp:1399:5:1399:40 | Load | m1399_6 | | ir.cpp:1401:9:1401:9 | Address | &:r1401_1 | | ir.cpp:1401:13:1401:41 | CallTarget | func:r1401_3 | | ir.cpp:1401:13:1401:41 | ChiPartial | partial:m1401_5 | @@ -8118,14 +8155,10 @@ | ir.cpp:1713:30:1713:31 | Address | &:r1713_1 | | ir.cpp:1714:31:1714:32 | Address | &:r1714_1 | | ir.cpp:1714:36:1714:55 | Address | &:r1714_2 | -| ir.cpp:1714:36:1714:55 | Address | &:r1714_3 | -| ir.cpp:1714:36:1714:55 | Address | &:r1714_3 | -| ir.cpp:1714:36:1714:55 | Load | m1714_5 | -| ir.cpp:1714:36:1714:55 | StoreValue | r1714_4 | +| ir.cpp:1714:36:1714:55 | StoreValue | r1714_3 | | ir.cpp:1714:36:1714:55 | StoreValue | r1714_6 | -| ir.cpp:1714:36:1714:55 | StoreValue | r1714_9 | | ir.cpp:1714:36:1714:55 | Unary | r1714_2 | -| ir.cpp:1714:36:1714:55 | Unary | r1714_8 | +| ir.cpp:1714:36:1714:55 | Unary | r1714_5 | | ir.cpp:1716:10:1716:17 | Address | &:r1716_1 | | ir.cpp:1716:20:1718:5 | Address | &:r1716_2 | | ir.cpp:1716:20:1718:5 | Address | &:r1716_2 | @@ -8151,7 +8184,7 @@ | ir.cpp:1716:20:1718:5 | Load | m1712_8 | | ir.cpp:1716:20:1718:5 | Load | m1712_12 | | ir.cpp:1716:20:1718:5 | Load | m1713_2 | -| ir.cpp:1716:20:1718:5 | Load | m1714_10 | +| ir.cpp:1716:20:1718:5 | Load | m1714_7 | | ir.cpp:1716:20:1718:5 | StoreValue | r1716_6 | | ir.cpp:1716:20:1718:5 | StoreValue | r1716_17 | | ir.cpp:1716:20:1718:5 | StoreValue | r1716_23 | @@ -8976,22 +9009,25 @@ | ir.cpp:1929:10:1929:10 | Address | &:r1929_3 | | ir.cpp:1930:3:1930:3 | Address | &:r1930_5 | | ir.cpp:1930:7:1930:7 | Address | &:r1930_2 | +| ir.cpp:1930:7:1930:7 | Address | &:r1930_2 | +| ir.cpp:1930:7:1930:12 | Load | m1930_3 | | ir.cpp:1930:7:1930:12 | StoreValue | r1930_4 | | ir.cpp:1930:11:1930:12 | StoreValue | r1930_1 | -| ir.cpp:1930:11:1930:12 | Unary | r1930_1 | | ir.cpp:1933:6:1933:38 | ChiPartial | partial:m1933_3 | | ir.cpp:1933:6:1933:38 | ChiTotal | total:m1933_2 | | ir.cpp:1933:6:1933:38 | SideEffect | m1933_3 | | ir.cpp:1934:7:1934:7 | Address | &:r1934_1 | | ir.cpp:1934:10:1934:10 | Address | &:r1934_3 | | ir.cpp:1934:13:1934:14 | StoreValue | r1934_4 | -| ir.cpp:1935:3:1935:3 | Address | &:r1935_6 | +| ir.cpp:1935:3:1935:3 | Address | &:r1935_7 | +| ir.cpp:1935:8:1935:8 | Address | &:r1935_2 | | ir.cpp:1935:8:1935:8 | Address | &:r1935_2 | | ir.cpp:1935:8:1935:8 | Address | &:r1935_2 | | ir.cpp:1935:8:1935:8 | Left | r1935_3 | | ir.cpp:1935:8:1935:8 | Load | m1934_5 | +| ir.cpp:1935:8:1935:14 | Load | m1935_5 | | ir.cpp:1935:8:1935:14 | StoreValue | r1935_4 | -| ir.cpp:1935:8:1935:14 | StoreValue | r1935_4 | +| ir.cpp:1935:8:1935:14 | StoreValue | r1935_6 | | ir.cpp:1935:13:1935:14 | Right | r1935_1 | | ir.cpp:1942:15:1942:43 | Address | &:r1942_5 | | ir.cpp:1942:15:1942:43 | ChiPartial | partial:m1942_3 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 019199d980d0..72cb60c3eedc 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -747,7 +747,7 @@ ir.c: # 9| r9_5(glval<(unnamed class/struct/union)>) = VariableAddress[coords] : # 9| r9_6(glval) = FieldAddress[y] : r9_5 # 9| mu9_7(int) = Store[?] : &:r9_6, r9_4 -# 9| r9_8(int) = CopyValue : r9_4 +# 9| r9_8(int) = Load[?] : &:r9_6, ~m? # 9| r9_9(glval<(unnamed class/struct/union)>) = VariableAddress[coords] : # 9| r9_10(glval) = FieldAddress[x] : r9_9 # 9| mu9_11(int) = Store[?] : &:r9_10, r9_8 @@ -1159,15 +1159,17 @@ ir.cpp: # 101| r101_3(int) = Constant[1] : # 101| r101_4(int) = Add : r101_2, r101_3 # 101| mu101_5(int) = Store[x] : &:r101_1, r101_4 -# 101| r101_6(glval) = VariableAddress[y] : -# 101| mu101_7(int) = Store[y] : &:r101_6, r101_4 +# 101| r101_6(int) = Load[x] : &:r101_1, ~m? +# 101| r101_7(glval) = VariableAddress[y] : +# 101| mu101_8(int) = Store[y] : &:r101_7, r101_6 # 102| r102_1(glval) = VariableAddress[x] : # 102| r102_2(int) = Load[x] : &:r102_1, ~m? # 102| r102_3(int) = Constant[1] : # 102| r102_4(int) = Sub : r102_2, r102_3 # 102| mu102_5(int) = Store[x] : &:r102_1, r102_4 -# 102| r102_6(glval) = VariableAddress[y] : -# 102| mu102_7(int) = Store[y] : &:r102_6, r102_4 +# 102| r102_6(int) = Load[x] : &:r102_1, ~m? +# 102| r102_7(glval) = VariableAddress[y] : +# 102| mu102_8(int) = Store[y] : &:r102_7, r102_6 # 103| r103_1(glval) = VariableAddress[x] : # 103| r103_2(int) = Load[x] : &:r103_1, ~m? # 103| r103_3(int) = Constant[1] : @@ -1375,15 +1377,17 @@ ir.cpp: # 147| r147_3(float) = Constant[1.0] : # 147| r147_4(float) = Add : r147_2, r147_3 # 147| mu147_5(float) = Store[x] : &:r147_1, r147_4 -# 147| r147_6(glval) = VariableAddress[y] : -# 147| mu147_7(float) = Store[y] : &:r147_6, r147_4 +# 147| r147_6(float) = Load[x] : &:r147_1, ~m? +# 147| r147_7(glval) = VariableAddress[y] : +# 147| mu147_8(float) = Store[y] : &:r147_7, r147_6 # 148| r148_1(glval) = VariableAddress[x] : # 148| r148_2(float) = Load[x] : &:r148_1, ~m? # 148| r148_3(float) = Constant[1.0] : # 148| r148_4(float) = Sub : r148_2, r148_3 # 148| mu148_5(float) = Store[x] : &:r148_1, r148_4 -# 148| r148_6(glval) = VariableAddress[y] : -# 148| mu148_7(float) = Store[y] : &:r148_6, r148_4 +# 148| r148_6(float) = Load[x] : &:r148_1, ~m? +# 148| r148_7(glval) = VariableAddress[y] : +# 148| mu148_8(float) = Store[y] : &:r148_7, r148_6 # 149| r149_1(glval) = VariableAddress[x] : # 149| r149_2(float) = Load[x] : &:r149_1, ~m? # 149| r149_3(float) = Constant[1.0] : @@ -1682,15 +1686,17 @@ ir.cpp: # 207| r207_3(int) = Constant[1] : # 207| r207_4(int *) = PointerAdd[4] : r207_2, r207_3 # 207| mu207_5(int *) = Store[p] : &:r207_1, r207_4 -# 207| r207_6(glval) = VariableAddress[q] : -# 207| mu207_7(int *) = Store[q] : &:r207_6, r207_4 +# 207| r207_6(int *) = Load[p] : &:r207_1, ~m? +# 207| r207_7(glval) = VariableAddress[q] : +# 207| mu207_8(int *) = Store[q] : &:r207_7, r207_6 # 208| r208_1(glval) = VariableAddress[p] : # 208| r208_2(int *) = Load[p] : &:r208_1, ~m? # 208| r208_3(int) = Constant[1] : # 208| r208_4(int *) = PointerSub[4] : r208_2, r208_3 # 208| mu208_5(int *) = Store[p] : &:r208_1, r208_4 -# 208| r208_6(glval) = VariableAddress[q] : -# 208| mu208_7(int *) = Store[q] : &:r208_6, r208_4 +# 208| r208_6(int *) = Load[p] : &:r208_1, ~m? +# 208| r208_7(glval) = VariableAddress[q] : +# 208| mu208_8(int *) = Store[q] : &:r208_7, r208_6 # 209| r209_1(glval) = VariableAddress[p] : # 209| r209_2(int *) = Load[p] : &:r209_1, ~m? # 209| r209_3(int) = Constant[1] : @@ -5726,6 +5732,26 @@ ir.cpp: # 1038| v1038_9(void) = AliasedUse : ~m? # 1038| v1038_10(void) = ExitFunction : +# 1038| void (lambda [] type at line 1038, col. 12)::(unnamed constructor)((lambda [] type at line 1038, col. 12)&&) +# 1038| Block 0 +# 1038| v1038_1(void) = EnterFunction : +# 1038| mu1038_2(unknown) = AliasedDefinition : +# 1038| mu1038_3(unknown) = InitializeNonLocal : +# 1038| r1038_4(glval) = VariableAddress[#this] : +# 1038| mu1038_5(glval) = InitializeParameter[#this] : &:r1038_4 +# 1038| r1038_6(glval) = Load[#this] : &:r1038_4, ~m? +# 1038| mu1038_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1038_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(lambda [] type at line 1038, col. 12 &&) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(lambda [] type at line 1038, col. 12 &&) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1038| v1038_8(void) = NoOp : +# 1038| v1038_9(void) = ReturnIndirection[#this] : &:r1038_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1038| v1038_10(void) = ReturnVoid : +# 1038| v1038_11(void) = AliasedUse : ~m? +# 1038| v1038_12(void) = ExitFunction : + # 1038| void (lambda [] type at line 1038, col. 12)::operator()() const # 1038| Block 0 # 1038| v1038_1(void) = EnterFunction : @@ -5920,6 +5946,26 @@ ir.cpp: # 1040| v1040_12(void) = AliasedUse : ~m? # 1040| v1040_13(void) = ExitFunction : +# 1041| void (void Lambda(int, String const&))::(lambda [] type at line 1041, col. 23)::(unnamed constructor)((void Lambda(int, String const&))::(lambda [] type at line 1041, col. 23)&&) +# 1041| Block 0 +# 1041| v1041_1(void) = EnterFunction : +# 1041| mu1041_2(unknown) = AliasedDefinition : +# 1041| mu1041_3(unknown) = InitializeNonLocal : +# 1041| r1041_4(glval) = VariableAddress[#this] : +# 1041| mu1041_5(glval) = InitializeParameter[#this] : &:r1041_4 +# 1041| r1041_6(glval) = Load[#this] : &:r1041_4, ~m? +# 1041| mu1041_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1041_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(lambda [] type at line 1041, col. 23 &&) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(lambda [] type at line 1041, col. 23 &&) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1041| v1041_8(void) = NoOp : +# 1041| v1041_9(void) = ReturnIndirection[#this] : &:r1041_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1041| v1041_10(void) = ReturnVoid : +# 1041| v1041_11(void) = AliasedUse : ~m? +# 1041| v1041_12(void) = ExitFunction : + # 1041| char (void Lambda(int, String const&))::(lambda [] type at line 1041, col. 23)::operator()(float) const # 1041| Block 0 # 1041| v1041_1(void) = EnterFunction : @@ -7672,7 +7718,6 @@ ir.cpp: # 1376| r1376_3(String) = Call[defaultConstruct] : func:r1376_2 # 1376| mu1376_4(unknown) = ^CallSideEffect : ~m? # 1376| mu1376_5(String) = Store[#temp1376:5] : &:r1376_1, r1376_3 -# 1376| r1376_6(String) = Load[#temp1376:5] : &:r1376_1, ~m? # 1377| v1377_1(void) = NoOp : # 1365| v1365_4(void) = ReturnVoid : # 1365| v1365_5(void) = AliasedUse : ~m? @@ -7737,7 +7782,6 @@ ir.cpp: # 1388| r1388_3(destructor_only) = Call[defaultConstruct] : func:r1388_2 # 1388| mu1388_4(unknown) = ^CallSideEffect : ~m? # 1388| mu1388_5(destructor_only) = Store[#temp1388:5] : &:r1388_1, r1388_3 -# 1388| r1388_6(destructor_only) = Load[#temp1388:5] : &:r1388_1, ~m? # 1389| v1389_1(void) = NoOp : # 1379| v1379_4(void) = ReturnVoid : # 1379| v1379_5(void) = AliasedUse : ~m? @@ -7815,7 +7859,6 @@ ir.cpp: # 1399| r1399_3(copy_constructor) = Call[defaultConstruct] : func:r1399_2 # 1399| mu1399_4(unknown) = ^CallSideEffect : ~m? # 1399| mu1399_5(copy_constructor) = Store[#temp1399:5] : &:r1399_1, r1399_3 -# 1399| r1399_6(copy_constructor) = Load[#temp1399:5] : &:r1399_1, ~m? # 1401| r1401_1(glval) = VariableAddress[y] : # 1401| r1401_2(glval) = VariableAddress[#temp1401:13] : # 1401| r1401_3(glval) = FunctionAddress[returnValue] : @@ -9216,14 +9259,11 @@ ir.cpp: # 1713| mu1713_2(TrivialLambdaClass) = Uninitialized[l1] : &:r1713_1 # 1714| r1714_1(glval) = VariableAddress[l2] : # 1714| r1714_2(glval) = VariableAddress[#temp1714:36] : -# 1714| r1714_3(glval) = VariableAddress[#temp1714:36] : -# 1714| r1714_4(TrivialLambdaClass) = Constant[0] : -# 1714| mu1714_5(TrivialLambdaClass) = Store[#temp1714:36] : &:r1714_3, r1714_4 -# 1714| r1714_6(TrivialLambdaClass) = Load[#temp1714:36] : &:r1714_3, ~m? -# 1714| mu1714_7(TrivialLambdaClass) = Store[#temp1714:36] : &:r1714_2, r1714_6 -# 1714| r1714_8(glval) = Convert : r1714_2 -# 1714| r1714_9(TrivialLambdaClass &) = CopyValue : r1714_8 -# 1714| mu1714_10(TrivialLambdaClass &) = Store[l2] : &:r1714_1, r1714_9 +# 1714| r1714_3(TrivialLambdaClass) = Constant[0] : +# 1714| mu1714_4(TrivialLambdaClass) = Store[#temp1714:36] : &:r1714_2, r1714_3 +# 1714| r1714_5(glval) = Convert : r1714_2 +# 1714| r1714_6(TrivialLambdaClass &) = CopyValue : r1714_5 +# 1714| mu1714_7(TrivialLambdaClass &) = Store[l2] : &:r1714_1, r1714_6 # 1716| r1716_1(glval) = VariableAddress[l_outer1] : # 1716| r1716_2(glval) = VariableAddress[#temp1716:20] : # 1716| mu1716_3(decltype([...](...){...})) = Uninitialized[#temp1716:20] : &:r1716_2 @@ -10298,7 +10338,7 @@ ir.cpp: # 1930| r1930_1(int) = Constant[40] : # 1930| r1930_2(glval) = VariableAddress[j] : # 1930| mu1930_3(int) = Store[j] : &:r1930_2, r1930_1 -# 1930| r1930_4(int) = CopyValue : r1930_1 +# 1930| r1930_4(int) = Load[j] : &:r1930_2, ~m? # 1930| r1930_5(glval) = VariableAddress[i] : # 1930| mu1930_6(int) = Store[i] : &:r1930_5, r1930_4 # 1931| v1931_1(void) = NoOp : @@ -10321,8 +10361,9 @@ ir.cpp: # 1935| r1935_3(int) = Load[j] : &:r1935_2, ~m? # 1935| r1935_4(int) = Add : r1935_3, r1935_1 # 1935| mu1935_5(int) = Store[j] : &:r1935_2, r1935_4 -# 1935| r1935_6(glval) = VariableAddress[i] : -# 1935| mu1935_7(int) = Store[i] : &:r1935_6, r1935_4 +# 1935| r1935_6(int) = Load[j] : &:r1935_2, ~m? +# 1935| r1935_7(glval) = VariableAddress[i] : +# 1935| mu1935_8(int) = Store[i] : &:r1935_7, r1935_6 # 1936| v1936_1(void) = NoOp : # 1933| v1933_4(void) = ReturnVoid : # 1933| v1933_5(void) = AliasedUse : ~m? diff --git a/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp index df29578409b8..4881e00fd29d 100644 --- a/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp +++ b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp @@ -672,7 +672,7 @@ void test17() { range(i); // $ range===50 i = 20 + (j -= 10); - range(i); // $ range="==Store: ... += ... | Store: ... = ...+10" range===60 + range(i); // $ range="==Store: ... += ... | Store: ... = ...+10" range===60 range="==Store: ... -= ...+20" } // Tests for unsigned multiplication. diff --git a/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected index eb1472ebfaa9..71d42c826e8a 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected @@ -17,6 +17,7 @@ localCallNodes postIsNotPre postHasUniquePre uniquePostUpdate +| allocators.cpp:4:24:4:26 | this indirection | Node has multiple PostUpdateNodes. | | cpp11.cpp:82:17:82:17 | this indirection | Node has multiple PostUpdateNodes. | | cpp11.cpp:82:17:82:55 | [...](...){...} indirection | Node has multiple PostUpdateNodes. | | ir.cpp:514:10:514:11 | definition of r2 indirection | Node has multiple PostUpdateNodes. | 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 88e365023a11..794d35433dfa 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected @@ -756,7 +756,7 @@ test.cpp: # 92| valnum = r92_1, r92_3, r93_2 # 92| m92_4(int) = Store[x] : &:r92_3, r92_2 # 92| valnum = m92_4, m92_6, m93_4, r92_2, r92_5, r93_3 -# 92| r92_5(int) = CopyValue : r92_2 +# 92| r92_5(int) = Load[x] : &:r92_3, m92_4 # 92| valnum = m92_4, m92_6, m93_4, r92_2, r92_5, r93_3 # 92| m92_6(int) = Store[x] : &:r92_1, r92_5 # 92| valnum = m92_4, m92_6, m93_4, r92_2, r92_5, r93_3 diff --git a/cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/argv/argvLocal.expected b/cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/argv/argvLocal.expected index c422484ea7d1..e91e6d4d0d5c 100644 --- a/cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/argv/argvLocal.expected +++ b/cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/argv/argvLocal.expected @@ -79,8 +79,6 @@ edges | argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:15:136:18 | -- ... | | argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:15:136:18 | -- ... | | argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:15:136:18 | -- ... | -| argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:15:136:18 | -- ... | -| argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:15:136:18 | -- ... | | argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:17:136:18 | i4 | | argvLocal.c:115:13:115:16 | argv | argvLocal.c:136:17:136:18 | i4 | | argvLocal.c:126:10:126:13 | argv | argvLocal.c:127:9:127:10 | i5 | @@ -193,7 +191,6 @@ nodes | argvLocal.c:135:9:135:12 | ... ++ | semmle.label | ... ++ | | argvLocal.c:136:15:136:18 | -- ... | semmle.label | -- ... | | argvLocal.c:136:15:136:18 | -- ... | semmle.label | -- ... | -| argvLocal.c:136:15:136:18 | -- ... | semmle.label | -- ... | | argvLocal.c:136:17:136:18 | i4 | semmle.label | i4 | | argvLocal.c:139:9:139:26 | ... ? ... : ... | semmle.label | ... ? ... : ... | | argvLocal.c:139:9:139:26 | ... ? ... : ... | semmle.label | ... ? ... : ... |