From d4746e05083bbb265e50b7430e7073cdfc2da839 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 29 Mar 2023 13:58:24 +0100 Subject: [PATCH 1/5] C++: Add test with VLA. --- .../ir/ssa/aliased_ssa_consistency.expected | 1 + .../aliased_ssa_consistency_unsound.expected | 1 + .../ir/ssa/aliased_ssa_ir.expected | 17 +++++++++++++++++ .../ir/ssa/aliased_ssa_ir_unsound.expected | 17 +++++++++++++++++ cpp/ql/test/library-tests/ir/ssa/ssa.cpp | 16 ++++++++++++++++ .../ir/ssa/unaliased_ssa_consistency.expected | 1 + .../unaliased_ssa_consistency_unsound.expected | 1 + .../ir/ssa/unaliased_ssa_ir.expected | 16 ++++++++++++++++ .../ir/ssa/unaliased_ssa_ir_unsound.expected | 16 ++++++++++++++++ 9 files changed, 86 insertions(+) diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected index 79887fffc1f..ac95c9c3437 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected @@ -6,6 +6,7 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected index 79887fffc1f..ac95c9c3437 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected @@ -6,6 +6,7 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected index 147c10b7c7f..282143c6bf6 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected @@ -1814,3 +1814,20 @@ ssa.cpp: # 383| Block 5 # 383| v383_17(void) = Unreached : + +# 401| void vla(int, int, int, bool) +# 401| Block 0 +# 401| v401_1(void) = EnterFunction : +# 401| m401_2(unknown) = AliasedDefinition : +# 401| m401_3(unknown) = InitializeNonLocal : +# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 +# 401| r401_5(glval) = VariableAddress[n1] : +# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 +# 401| r401_7(glval) = VariableAddress[n2] : +# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 +# 401| r401_9(glval) = VariableAddress[n3] : +# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 +# 401| r401_11(glval) = VariableAddress[b1] : +# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected index 396b7532d68..ac58290efe7 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected @@ -1804,3 +1804,20 @@ ssa.cpp: # 383| Block 5 # 383| v383_17(void) = Unreached : + +# 401| void vla(int, int, int, bool) +# 401| Block 0 +# 401| v401_1(void) = EnterFunction : +# 401| m401_2(unknown) = AliasedDefinition : +# 401| m401_3(unknown) = InitializeNonLocal : +# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 +# 401| r401_5(glval) = VariableAddress[n1] : +# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 +# 401| r401_7(glval) = VariableAddress[n2] : +# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 +# 401| r401_9(glval) = VariableAddress[n3] : +# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 +# 401| r401_11(glval) = VariableAddress[b1] : +# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 diff --git a/cpp/ql/test/library-tests/ir/ssa/ssa.cpp b/cpp/ql/test/library-tests/ir/ssa/ssa.cpp index ec8ea81e9e4..98c33c3eddf 100644 --- a/cpp/ql/test/library-tests/ir/ssa/ssa.cpp +++ b/cpp/ql/test/library-tests/ir/ssa/ssa.cpp @@ -396,4 +396,20 @@ int FusedBlockPhiOperand(int x, int y, int z, bool b1) { } return ret; +} + +void vla(int n1, int n2, int n3, bool b1) { + int b[n1]; + int c[n1][n2]; + + *b = 0; + b[0] = 1; + + **(c + 1) = 0; + + if(b1) { + int b[n1]; + } else { + int b[n2]; + } } \ No newline at end of file diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected index 79887fffc1f..ac95c9c3437 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected @@ -6,6 +6,7 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected index 79887fffc1f..ac95c9c3437 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected @@ -6,6 +6,7 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected index 3fc07bf6950..17bfcb76146 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected @@ -1695,3 +1695,19 @@ ssa.cpp: # 383| v383_13(void) = ReturnValue : &:r383_12, m398_5 # 383| v383_14(void) = AliasedUse : ~m? # 383| v383_15(void) = ExitFunction : + +# 401| void vla(int, int, int, bool) +# 401| Block 0 +# 401| v401_1(void) = EnterFunction : +# 401| mu401_2(unknown) = AliasedDefinition : +# 401| mu401_3(unknown) = InitializeNonLocal : +# 401| r401_4(glval) = VariableAddress[n1] : +# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 +# 401| r401_6(glval) = VariableAddress[n2] : +# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 +# 401| r401_8(glval) = VariableAddress[n3] : +# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 +# 401| r401_10(glval) = VariableAddress[b1] : +# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected index 3fc07bf6950..17bfcb76146 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected @@ -1695,3 +1695,19 @@ ssa.cpp: # 383| v383_13(void) = ReturnValue : &:r383_12, m398_5 # 383| v383_14(void) = AliasedUse : ~m? # 383| v383_15(void) = ExitFunction : + +# 401| void vla(int, int, int, bool) +# 401| Block 0 +# 401| v401_1(void) = EnterFunction : +# 401| mu401_2(unknown) = AliasedDefinition : +# 401| mu401_3(unknown) = InitializeNonLocal : +# 401| r401_4(glval) = VariableAddress[n1] : +# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 +# 401| r401_6(glval) = VariableAddress[n2] : +# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 +# 401| r401_8(glval) = VariableAddress[n3] : +# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 +# 401| r401_10(glval) = VariableAddress[b1] : +# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 From fb6e45b6f42bc5fe2b292209eb286df00d57efb0 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 29 Mar 2023 13:58:39 +0100 Subject: [PATCH 2/5] C++: Emit a NoOp during CFG construction for VLAs. --- .../raw/internal/TranslatedStmt.qll | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll index da4183ca25c..064425476f7 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll @@ -1105,3 +1105,49 @@ class TranslatedAsmStmt extends TranslatedStmt { ) } } + +class TranslatedVlaDimensionStmt extends TranslatedStmt { + override VlaDimensionStmt stmt; + + override TranslatedExpr getChild(int id) { + id = 0 and + result = getTranslatedExpr(stmt.getDimensionExpr().getFullyConverted()) + } + + override Instruction getFirstInstruction() { result = getChild(0).getFirstInstruction() } + + override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) { + none() + } + + override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { none() } + + override Instruction getChildSuccessor(TranslatedElement child) { + child = getChild(0) and + result = getParent().getChildSuccessor(this) + } +} + +class TranslatedVlaDeclarationStmt extends TranslatedStmt { + override VlaDeclStmt stmt; + + override TranslatedExpr getChild(int id) { none() } + + override Instruction getFirstInstruction() { result = getInstruction(OnlyInstructionTag()) } + + override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) { + // TODO: This needs a new kind of instruction that represents initialization of a VLA. + // For now we just emit a `NoOp` instruction so that the CFG isn't incomplete. + tag = OnlyInstructionTag() and + opcode instanceof Opcode::NoOp and + resultType = getVoidType() + } + + override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { + tag = OnlyInstructionTag() and + result = getParent().getChildSuccessor(this) and + kind instanceof GotoEdge + } + + override Instruction getChildSuccessor(TranslatedElement child) { none() } +} From 0e9ed989e0ff57aea2d554e1c7fa8354d48ddc34 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 29 Mar 2023 14:01:01 +0100 Subject: [PATCH 3/5] C++: Accept test changes. --- .../ir/ssa/aliased_ssa_consistency.expected | 1 - .../aliased_ssa_consistency_unsound.expected | 1 - .../ir/ssa/aliased_ssa_ir.expected | 89 ++++++++++++++++--- .../ir/ssa/aliased_ssa_ir_unsound.expected | 88 +++++++++++++++--- .../ir/ssa/unaliased_ssa_consistency.expected | 1 - ...unaliased_ssa_consistency_unsound.expected | 1 - .../ir/ssa/unaliased_ssa_ir.expected | 83 ++++++++++++++--- .../ir/ssa/unaliased_ssa_ir_unsound.expected | 83 ++++++++++++++--- 8 files changed, 289 insertions(+), 58 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected index ac95c9c3437..79887fffc1f 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected index ac95c9c3437..79887fffc1f 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_consistency_unsound.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected index 282143c6bf6..7f76af075a7 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected @@ -1817,17 +1817,78 @@ ssa.cpp: # 401| void vla(int, int, int, bool) # 401| Block 0 -# 401| v401_1(void) = EnterFunction : -# 401| m401_2(unknown) = AliasedDefinition : -# 401| m401_3(unknown) = InitializeNonLocal : -# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 -# 401| r401_5(glval) = VariableAddress[n1] : -# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 -# 401| r401_7(glval) = VariableAddress[n2] : -# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 -# 401| r401_9(glval) = VariableAddress[n3] : -# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 -# 401| r401_11(glval) = VariableAddress[b1] : -# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 -# 402| r402_1(glval) = VariableAddress[b] : -# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 +# 401| v401_1(void) = EnterFunction : +# 401| m401_2(unknown) = AliasedDefinition : +# 401| m401_3(unknown) = InitializeNonLocal : +# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 +# 401| r401_5(glval) = VariableAddress[n1] : +# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 +# 401| r401_7(glval) = VariableAddress[n2] : +# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 +# 401| r401_9(glval) = VariableAddress[n3] : +# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 +# 401| r401_11(glval) = VariableAddress[b1] : +# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 +# 402| r402_3(glval) = VariableAddress[n1] : +# 402| r402_4(int) = Load[n1] : &:r402_3, m401_6 +# 402| v402_5(void) = NoOp : +# 403| r403_1(glval) = VariableAddress[c] : +# 403| m403_2(int[][]) = Uninitialized[c] : &:r403_1 +# 403| m403_3(unknown) = Chi : total:m401_4, partial:m403_2 +# 403| r403_4(glval) = VariableAddress[n1] : +# 403| r403_5(int) = Load[n1] : &:r403_4, m401_6 +# 403| r403_6(glval) = VariableAddress[n2] : +# 403| r403_7(int) = Load[n2] : &:r403_6, m401_8 +# 403| v403_8(void) = NoOp : +# 405| r405_1(int) = Constant[0] : +# 405| r405_2(glval) = VariableAddress[b] : +# 405| r405_3(int *) = Convert : r405_2 +# 405| r405_4(glval) = CopyValue : r405_3 +# 405| m405_5(int) = Store[?] : &:r405_4, r405_1 +# 405| m405_6(int[]) = Chi : total:m402_2, partial:m405_5 +# 406| r406_1(int) = Constant[1] : +# 406| r406_2(glval) = VariableAddress[b] : +# 406| r406_3(int *) = Convert : r406_2 +# 406| r406_4(int) = Constant[0] : +# 406| r406_5(glval) = PointerAdd[4] : r406_3, r406_4 +# 406| m406_6(int) = Store[?] : &:r406_5, r406_1 +# 406| m406_7(int[]) = Chi : total:m405_6, partial:m406_6 +# 408| r408_1(int) = Constant[0] : +# 408| r408_2(glval) = VariableAddress[c] : +# 408| r408_3(int(*)[]) = Convert : r408_2 +# 408| r408_4(int) = Constant[1] : +# 408| r408_5(int(*)[]) = PointerAdd : r408_3, r408_4 +# 408| r408_6(glval) = CopyValue : r408_5 +# 408| r408_7(int *) = Convert : r408_6 +# 408| r408_8(glval) = CopyValue : r408_7 +# 408| m408_9(int) = Store[?] : &:r408_8, r408_1 +# 408| m408_10(unknown) = Chi : total:m403_3, partial:m408_9 +# 410| r410_1(glval) = VariableAddress[b1] : +# 410| r410_2(bool) = Load[b1] : &:r410_1, m401_12 +# 410| v410_3(void) = ConditionalBranch : r410_2 +#-----| False -> Block 2 +#-----| True -> Block 1 + +# 411| Block 1 +# 411| r411_1(glval) = VariableAddress[b] : +# 411| m411_2(int[]) = Uninitialized[b] : &:r411_1 +# 411| r411_3(glval) = VariableAddress[n1] : +# 411| r411_4(int) = Load[n1] : &:r411_3, m401_6 +# 411| v411_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 413| Block 2 +# 413| r413_1(glval) = VariableAddress[b] : +# 413| m413_2(int[]) = Uninitialized[b] : &:r413_1 +# 413| r413_3(glval) = VariableAddress[n2] : +# 413| r413_4(int) = Load[n2] : &:r413_3, m401_8 +# 413| v413_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 415| Block 3 +# 415| v415_1(void) = NoOp : +# 401| v401_13(void) = ReturnVoid : +# 401| v401_14(void) = AliasedUse : ~m408_10 +# 401| v401_15(void) = ExitFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected index ac58290efe7..1ad86dc0da0 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected @@ -1807,17 +1807,77 @@ ssa.cpp: # 401| void vla(int, int, int, bool) # 401| Block 0 -# 401| v401_1(void) = EnterFunction : -# 401| m401_2(unknown) = AliasedDefinition : -# 401| m401_3(unknown) = InitializeNonLocal : -# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 -# 401| r401_5(glval) = VariableAddress[n1] : -# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 -# 401| r401_7(glval) = VariableAddress[n2] : -# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 -# 401| r401_9(glval) = VariableAddress[n3] : -# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 -# 401| r401_11(glval) = VariableAddress[b1] : -# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 -# 402| r402_1(glval) = VariableAddress[b] : -# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 +# 401| v401_1(void) = EnterFunction : +# 401| m401_2(unknown) = AliasedDefinition : +# 401| m401_3(unknown) = InitializeNonLocal : +# 401| m401_4(unknown) = Chi : total:m401_2, partial:m401_3 +# 401| r401_5(glval) = VariableAddress[n1] : +# 401| m401_6(int) = InitializeParameter[n1] : &:r401_5 +# 401| r401_7(glval) = VariableAddress[n2] : +# 401| m401_8(int) = InitializeParameter[n2] : &:r401_7 +# 401| r401_9(glval) = VariableAddress[n3] : +# 401| m401_10(int) = InitializeParameter[n3] : &:r401_9 +# 401| r401_11(glval) = VariableAddress[b1] : +# 401| m401_12(bool) = InitializeParameter[b1] : &:r401_11 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| m402_2(int[]) = Uninitialized[b] : &:r402_1 +# 402| r402_3(glval) = VariableAddress[n1] : +# 402| r402_4(int) = Load[n1] : &:r402_3, m401_6 +# 402| v402_5(void) = NoOp : +# 403| r403_1(glval) = VariableAddress[c] : +# 403| m403_2(int[][]) = Uninitialized[c] : &:r403_1 +# 403| r403_3(glval) = VariableAddress[n1] : +# 403| r403_4(int) = Load[n1] : &:r403_3, m401_6 +# 403| r403_5(glval) = VariableAddress[n2] : +# 403| r403_6(int) = Load[n2] : &:r403_5, m401_8 +# 403| v403_7(void) = NoOp : +# 405| r405_1(int) = Constant[0] : +# 405| r405_2(glval) = VariableAddress[b] : +# 405| r405_3(int *) = Convert : r405_2 +# 405| r405_4(glval) = CopyValue : r405_3 +# 405| m405_5(int) = Store[?] : &:r405_4, r405_1 +# 405| m405_6(int[]) = Chi : total:m402_2, partial:m405_5 +# 406| r406_1(int) = Constant[1] : +# 406| r406_2(glval) = VariableAddress[b] : +# 406| r406_3(int *) = Convert : r406_2 +# 406| r406_4(int) = Constant[0] : +# 406| r406_5(glval) = PointerAdd[4] : r406_3, r406_4 +# 406| m406_6(int) = Store[?] : &:r406_5, r406_1 +# 406| m406_7(int[]) = Chi : total:m405_6, partial:m406_6 +# 408| r408_1(int) = Constant[0] : +# 408| r408_2(glval) = VariableAddress[c] : +# 408| r408_3(int(*)[]) = Convert : r408_2 +# 408| r408_4(int) = Constant[1] : +# 408| r408_5(int(*)[]) = PointerAdd : r408_3, r408_4 +# 408| r408_6(glval) = CopyValue : r408_5 +# 408| r408_7(int *) = Convert : r408_6 +# 408| r408_8(glval) = CopyValue : r408_7 +# 408| m408_9(int) = Store[?] : &:r408_8, r408_1 +# 408| m408_10(unknown) = Chi : total:m401_4, partial:m408_9 +# 410| r410_1(glval) = VariableAddress[b1] : +# 410| r410_2(bool) = Load[b1] : &:r410_1, m401_12 +# 410| v410_3(void) = ConditionalBranch : r410_2 +#-----| False -> Block 2 +#-----| True -> Block 1 + +# 411| Block 1 +# 411| r411_1(glval) = VariableAddress[b] : +# 411| m411_2(int[]) = Uninitialized[b] : &:r411_1 +# 411| r411_3(glval) = VariableAddress[n1] : +# 411| r411_4(int) = Load[n1] : &:r411_3, m401_6 +# 411| v411_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 413| Block 2 +# 413| r413_1(glval) = VariableAddress[b] : +# 413| m413_2(int[]) = Uninitialized[b] : &:r413_1 +# 413| r413_3(glval) = VariableAddress[n2] : +# 413| r413_4(int) = Load[n2] : &:r413_3, m401_8 +# 413| v413_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 415| Block 3 +# 415| v415_1(void) = NoOp : +# 401| v401_13(void) = ReturnVoid : +# 401| v401_14(void) = AliasedUse : ~m408_10 +# 401| v401_15(void) = ExitFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected index ac95c9c3437..79887fffc1f 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected index ac95c9c3437..79887fffc1f 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_consistency_unsound.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ssa.cpp:402:7:402:7 | Uninitialized: definition of b | Instruction 'Uninitialized: definition of b' has no successors in function '$@'. | ssa.cpp:401:6:401:8 | void vla(int, int, int, bool) | void vla(int, int, int, bool) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected index 17bfcb76146..03de47a1ab0 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected @@ -1698,16 +1698,73 @@ ssa.cpp: # 401| void vla(int, int, int, bool) # 401| Block 0 -# 401| v401_1(void) = EnterFunction : -# 401| mu401_2(unknown) = AliasedDefinition : -# 401| mu401_3(unknown) = InitializeNonLocal : -# 401| r401_4(glval) = VariableAddress[n1] : -# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 -# 401| r401_6(glval) = VariableAddress[n2] : -# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 -# 401| r401_8(glval) = VariableAddress[n3] : -# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 -# 401| r401_10(glval) = VariableAddress[b1] : -# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 -# 402| r402_1(glval) = VariableAddress[b] : -# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 +# 401| v401_1(void) = EnterFunction : +# 401| mu401_2(unknown) = AliasedDefinition : +# 401| mu401_3(unknown) = InitializeNonLocal : +# 401| r401_4(glval) = VariableAddress[n1] : +# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 +# 401| r401_6(glval) = VariableAddress[n2] : +# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 +# 401| r401_8(glval) = VariableAddress[n3] : +# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 +# 401| r401_10(glval) = VariableAddress[b1] : +# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 +# 402| r402_3(glval) = VariableAddress[n1] : +# 402| r402_4(int) = Load[n1] : &:r402_3, m401_5 +# 402| v402_5(void) = NoOp : +# 403| r403_1(glval) = VariableAddress[c] : +# 403| mu403_2(int[][]) = Uninitialized[c] : &:r403_1 +# 403| r403_3(glval) = VariableAddress[n1] : +# 403| r403_4(int) = Load[n1] : &:r403_3, m401_5 +# 403| r403_5(glval) = VariableAddress[n2] : +# 403| r403_6(int) = Load[n2] : &:r403_5, m401_7 +# 403| v403_7(void) = NoOp : +# 405| r405_1(int) = Constant[0] : +# 405| r405_2(glval) = VariableAddress[b] : +# 405| r405_3(int *) = Convert : r405_2 +# 405| r405_4(glval) = CopyValue : r405_3 +# 405| mu405_5(int) = Store[?] : &:r405_4, r405_1 +# 406| r406_1(int) = Constant[1] : +# 406| r406_2(glval) = VariableAddress[b] : +# 406| r406_3(int *) = Convert : r406_2 +# 406| r406_4(int) = Constant[0] : +# 406| r406_5(glval) = PointerAdd[4] : r406_3, r406_4 +# 406| mu406_6(int) = Store[?] : &:r406_5, r406_1 +# 408| r408_1(int) = Constant[0] : +# 408| r408_2(glval) = VariableAddress[c] : +# 408| r408_3(int(*)[]) = Convert : r408_2 +# 408| r408_4(int) = Constant[1] : +# 408| r408_5(int(*)[]) = PointerAdd : r408_3, r408_4 +# 408| r408_6(glval) = CopyValue : r408_5 +# 408| r408_7(int *) = Convert : r408_6 +# 408| r408_8(glval) = CopyValue : r408_7 +# 408| mu408_9(int) = Store[?] : &:r408_8, r408_1 +# 410| r410_1(glval) = VariableAddress[b1] : +# 410| r410_2(bool) = Load[b1] : &:r410_1, m401_11 +# 410| v410_3(void) = ConditionalBranch : r410_2 +#-----| False -> Block 2 +#-----| True -> Block 1 + +# 411| Block 1 +# 411| r411_1(glval) = VariableAddress[b] : +# 411| m411_2(int[]) = Uninitialized[b] : &:r411_1 +# 411| r411_3(glval) = VariableAddress[n1] : +# 411| r411_4(int) = Load[n1] : &:r411_3, m401_5 +# 411| v411_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 413| Block 2 +# 413| r413_1(glval) = VariableAddress[b] : +# 413| m413_2(int[]) = Uninitialized[b] : &:r413_1 +# 413| r413_3(glval) = VariableAddress[n2] : +# 413| r413_4(int) = Load[n2] : &:r413_3, m401_7 +# 413| v413_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 415| Block 3 +# 415| v415_1(void) = NoOp : +# 401| v401_12(void) = ReturnVoid : +# 401| v401_13(void) = AliasedUse : ~m? +# 401| v401_14(void) = ExitFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected index 17bfcb76146..03de47a1ab0 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected @@ -1698,16 +1698,73 @@ ssa.cpp: # 401| void vla(int, int, int, bool) # 401| Block 0 -# 401| v401_1(void) = EnterFunction : -# 401| mu401_2(unknown) = AliasedDefinition : -# 401| mu401_3(unknown) = InitializeNonLocal : -# 401| r401_4(glval) = VariableAddress[n1] : -# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 -# 401| r401_6(glval) = VariableAddress[n2] : -# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 -# 401| r401_8(glval) = VariableAddress[n3] : -# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 -# 401| r401_10(glval) = VariableAddress[b1] : -# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 -# 402| r402_1(glval) = VariableAddress[b] : -# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 +# 401| v401_1(void) = EnterFunction : +# 401| mu401_2(unknown) = AliasedDefinition : +# 401| mu401_3(unknown) = InitializeNonLocal : +# 401| r401_4(glval) = VariableAddress[n1] : +# 401| m401_5(int) = InitializeParameter[n1] : &:r401_4 +# 401| r401_6(glval) = VariableAddress[n2] : +# 401| m401_7(int) = InitializeParameter[n2] : &:r401_6 +# 401| r401_8(glval) = VariableAddress[n3] : +# 401| m401_9(int) = InitializeParameter[n3] : &:r401_8 +# 401| r401_10(glval) = VariableAddress[b1] : +# 401| m401_11(bool) = InitializeParameter[b1] : &:r401_10 +# 402| r402_1(glval) = VariableAddress[b] : +# 402| mu402_2(int[]) = Uninitialized[b] : &:r402_1 +# 402| r402_3(glval) = VariableAddress[n1] : +# 402| r402_4(int) = Load[n1] : &:r402_3, m401_5 +# 402| v402_5(void) = NoOp : +# 403| r403_1(glval) = VariableAddress[c] : +# 403| mu403_2(int[][]) = Uninitialized[c] : &:r403_1 +# 403| r403_3(glval) = VariableAddress[n1] : +# 403| r403_4(int) = Load[n1] : &:r403_3, m401_5 +# 403| r403_5(glval) = VariableAddress[n2] : +# 403| r403_6(int) = Load[n2] : &:r403_5, m401_7 +# 403| v403_7(void) = NoOp : +# 405| r405_1(int) = Constant[0] : +# 405| r405_2(glval) = VariableAddress[b] : +# 405| r405_3(int *) = Convert : r405_2 +# 405| r405_4(glval) = CopyValue : r405_3 +# 405| mu405_5(int) = Store[?] : &:r405_4, r405_1 +# 406| r406_1(int) = Constant[1] : +# 406| r406_2(glval) = VariableAddress[b] : +# 406| r406_3(int *) = Convert : r406_2 +# 406| r406_4(int) = Constant[0] : +# 406| r406_5(glval) = PointerAdd[4] : r406_3, r406_4 +# 406| mu406_6(int) = Store[?] : &:r406_5, r406_1 +# 408| r408_1(int) = Constant[0] : +# 408| r408_2(glval) = VariableAddress[c] : +# 408| r408_3(int(*)[]) = Convert : r408_2 +# 408| r408_4(int) = Constant[1] : +# 408| r408_5(int(*)[]) = PointerAdd : r408_3, r408_4 +# 408| r408_6(glval) = CopyValue : r408_5 +# 408| r408_7(int *) = Convert : r408_6 +# 408| r408_8(glval) = CopyValue : r408_7 +# 408| mu408_9(int) = Store[?] : &:r408_8, r408_1 +# 410| r410_1(glval) = VariableAddress[b1] : +# 410| r410_2(bool) = Load[b1] : &:r410_1, m401_11 +# 410| v410_3(void) = ConditionalBranch : r410_2 +#-----| False -> Block 2 +#-----| True -> Block 1 + +# 411| Block 1 +# 411| r411_1(glval) = VariableAddress[b] : +# 411| m411_2(int[]) = Uninitialized[b] : &:r411_1 +# 411| r411_3(glval) = VariableAddress[n1] : +# 411| r411_4(int) = Load[n1] : &:r411_3, m401_5 +# 411| v411_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 413| Block 2 +# 413| r413_1(glval) = VariableAddress[b] : +# 413| m413_2(int[]) = Uninitialized[b] : &:r413_1 +# 413| r413_3(glval) = VariableAddress[n2] : +# 413| r413_4(int) = Load[n2] : &:r413_3, m401_7 +# 413| v413_5(void) = NoOp : +#-----| Goto -> Block 3 + +# 415| Block 3 +# 415| v415_1(void) = NoOp : +# 401| v401_12(void) = ReturnVoid : +# 401| v401_13(void) = AliasedUse : ~m? +# 401| v401_14(void) = ExitFunction : From 3bd193f721b07b2ddee5a4eb4b5ad57d937bab57 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 29 Mar 2023 14:02:34 +0100 Subject: [PATCH 4/5] C++: Fix Code Scanning errors. --- .../ir/implementation/raw/internal/TranslatedStmt.qll | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll index 064425476f7..f0d8e5d3d35 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedStmt.qll @@ -1114,7 +1114,7 @@ class TranslatedVlaDimensionStmt extends TranslatedStmt { result = getTranslatedExpr(stmt.getDimensionExpr().getFullyConverted()) } - override Instruction getFirstInstruction() { result = getChild(0).getFirstInstruction() } + override Instruction getFirstInstruction() { result = this.getChild(0).getFirstInstruction() } override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) { none() @@ -1123,8 +1123,8 @@ class TranslatedVlaDimensionStmt extends TranslatedStmt { override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { none() } override Instruction getChildSuccessor(TranslatedElement child) { - child = getChild(0) and - result = getParent().getChildSuccessor(this) + child = this.getChild(0) and + result = this.getParent().getChildSuccessor(this) } } @@ -1133,7 +1133,7 @@ class TranslatedVlaDeclarationStmt extends TranslatedStmt { override TranslatedExpr getChild(int id) { none() } - override Instruction getFirstInstruction() { result = getInstruction(OnlyInstructionTag()) } + override Instruction getFirstInstruction() { result = this.getInstruction(OnlyInstructionTag()) } override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) { // TODO: This needs a new kind of instruction that represents initialization of a VLA. @@ -1145,7 +1145,7 @@ class TranslatedVlaDeclarationStmt extends TranslatedStmt { override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { tag = OnlyInstructionTag() and - result = getParent().getChildSuccessor(this) and + result = this.getParent().getChildSuccessor(this) and kind instanceof GotoEdge } From 65c7a504b224081a60cd2185e914790d8cce9874 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 29 Mar 2023 15:08:50 +0100 Subject: [PATCH 5/5] C++: Accept test changes. --- .../aliased_ssa_consistency.expected | 3 --- .../syntax-zoo/raw_consistency.expected | 19 ------------------- .../unaliased_ssa_consistency.expected | 3 --- 3 files changed, 25 deletions(-) diff --git a/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected index 63b6f72905b..d94b3df0bb3 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected @@ -12,12 +12,9 @@ instructionWithoutSuccessor | condition_decls.cpp:26:23:26:24 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:25:6:25:21 | void switch_decl_bind(int) | void switch_decl_bind(int) | | condition_decls.cpp:41:22:41:23 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) | | condition_decls.cpp:48:52:48:53 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) | -| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | | ms_try_mix.cpp:35:13:35:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | | ms_try_mix.cpp:53:5:53:11 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | | stmt_expr.cpp:27:5:27:15 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | stmt_expr.cpp:21:13:21:13 | void stmtexpr::g(int) | void stmtexpr::g(int) | -| vla.c:5:9:5:14 | Uninitialized: definition of matrix | Instruction 'Uninitialized: definition of matrix' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | -| vla.c:11:6:11:16 | Chi: vla_typedef | Instruction 'Chi: vla_typedef' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected index a498c7e4b23..6fa6c863aeb 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected @@ -23,29 +23,11 @@ instructionWithoutSuccessor | file://:0:0:0:0 | CompareNE: (bool)... | Instruction 'CompareNE: (bool)...' has no successors in function '$@'. | condition_decls.cpp:15:6:15:17 | void if_decl_bind(int) | void if_decl_bind(int) | | file://:0:0:0:0 | CompareNE: (bool)... | Instruction 'CompareNE: (bool)...' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) | | file://:0:0:0:0 | CompareNE: (bool)... | Instruction 'CompareNE: (bool)...' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) | -| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:171:15:171:31 | Add: ... + ... | Instruction 'Add: ... + ...' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:173:14:173:26 | Mul: ... * ... | Instruction 'Mul: ... * ...' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:173:37:173:39 | Store: array to pointer conversion | Instruction 'Store: array to pointer conversion' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:174:17:174:22 | CallSideEffect: call to getInt | Instruction 'CallSideEffect: call to getInt' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:174:30:174:35 | CallSideEffect: call to getInt | Instruction 'CallSideEffect: call to getInt' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | -| misc.c:174:55:174:60 | Store: (char ****)... | Instruction 'Store: (char ****)...' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | | ms_try_mix.cpp:35:13:35:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | | ms_try_mix.cpp:53:5:53:11 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | | stmt_expr.cpp:27:5:27:15 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | stmt_expr.cpp:21:13:21:13 | void stmtexpr::g(int) | void stmtexpr::g(int) | | stmt_expr.cpp:29:11:32:11 | CopyValue: (statement expression) | Instruction 'CopyValue: (statement expression)' has no successors in function '$@'. | stmt_expr.cpp:21:13:21:13 | void stmtexpr::g(int) | void stmtexpr::g(int) | | stmt_in_type.cpp:5:53:5:53 | Constant: 1 | Instruction 'Constant: 1' has no successors in function '$@'. | stmt_in_type.cpp:2:6:2:12 | void cpp_fun() | void cpp_fun() | -| vla.c:5:9:5:14 | Uninitialized: definition of matrix | Instruction 'Uninitialized: definition of matrix' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | -| vla.c:5:16:5:19 | Load: argc | Instruction 'Load: argc' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | -| vla.c:5:27:5:33 | BufferReadSideEffect: (const char *)... | Instruction 'BufferReadSideEffect: (const char *)...' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | -| vla.c:11:6:11:16 | InitializeNonLocal: vla_typedef | Instruction 'InitializeNonLocal: vla_typedef' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:12:33:12:44 | Add: ... + ... | Instruction 'Add: ... + ...' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:12:50:12:62 | Mul: ... * ... | Instruction 'Mul: ... * ...' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:13:12:13:14 | Uninitialized: definition of var | Instruction 'Uninitialized: definition of var' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:14:36:14:47 | Add: ... + ... | Instruction 'Add: ... + ...' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:14:53:14:65 | Mul: ... * ... | Instruction 'Mul: ... * ...' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:14:74:14:79 | CallSideEffect: call to getInt | Instruction 'CallSideEffect: call to getInt' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | -| vla.c:14:92:14:94 | Store: (char *)... | Instruction 'Store: (char *)...' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction @@ -65,7 +47,6 @@ useNotDominatedByDefinition | ms_try_except.cpp:19:17:19:21 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) | | static_init_templates.cpp:15:1:15:18 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | static_init_templates.cpp:15:1:15:18 | void MyClass::MyClass() | void MyClass::MyClass() | | try_catch.cpp:21:9:21:9 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | try_catch.cpp:19:6:19:23 | void throw_from_nonstmt(int) | void throw_from_nonstmt(int) | -| vla.c:3:31:3:34 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated diff --git a/cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected index 4e67089ba0a..6706c66c0a2 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected @@ -12,12 +12,9 @@ instructionWithoutSuccessor | condition_decls.cpp:26:23:26:24 | IndirectMayWriteSideEffect: call to BoxedInt | Instruction 'IndirectMayWriteSideEffect: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:25:6:25:21 | void switch_decl_bind(int) | void switch_decl_bind(int) | | condition_decls.cpp:41:22:41:23 | IndirectMayWriteSideEffect: call to BoxedInt | Instruction 'IndirectMayWriteSideEffect: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) | | condition_decls.cpp:48:52:48:53 | IndirectMayWriteSideEffect: call to BoxedInt | Instruction 'IndirectMayWriteSideEffect: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) | -| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() | | ms_try_mix.cpp:35:13:35:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | | ms_try_mix.cpp:53:5:53:11 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | | stmt_expr.cpp:27:5:27:15 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | stmt_expr.cpp:21:13:21:13 | void stmtexpr::g(int) | void stmtexpr::g(int) | -| vla.c:5:9:5:14 | Uninitialized: definition of matrix | Instruction 'Uninitialized: definition of matrix' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) | -| vla.c:11:6:11:16 | InitializeNonLocal: vla_typedef | Instruction 'InitializeNonLocal: vla_typedef' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction