From 8624f19f7e83c2beffe2ae9b024e7bfe655a9f13 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 11:10:23 -0500 Subject: [PATCH 1/9] Adding basic SEH edge support. SEH exceptions are only considered for calls. Load and store SEH handling will be addressed in a separate PR. --- .../raw/internal/TranslatedCall.qll | 92 ++++++++++++++----- .../raw/internal/TranslatedElement.qll | 4 +- .../raw/internal/TranslatedExpr.qll | 25 +++-- .../raw/internal/TranslatedFunction.qll | 13 ++- .../raw/internal/TranslatedStmt.qll | 47 +++++++--- .../code/cpp/models/interfaces/Throwing.qll | 8 +- 6 files changed, 136 insertions(+), 53 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll index 4f8932c4a289..a39d7c6450d0 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll @@ -4,6 +4,7 @@ private import semmle.code.cpp.ir.implementation.internal.OperandTag private import semmle.code.cpp.ir.internal.CppType private import semmle.code.cpp.models.interfaces.SideEffect private import semmle.code.cpp.models.interfaces.Throwing +private import semmle.code.cpp.models.interfaces.NonThrowing private import InstructionTag private import SideEffects private import TranslatedElement @@ -84,12 +85,14 @@ abstract class TranslatedCall extends TranslatedExpr { this.getEnclosingFunction().getFunction() = instr.getEnclosingFunction() ) else ( - not this.mustThrowException() and + not this.mustThrowException(_) and result = this.getParent().getChildSuccessor(this, kind) or - this.mayThrowException() and - kind instanceof CppExceptionEdge and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) + exists(ExceptionEdge e | this.hasExceptionBehavior(e) | + this.mayThrowException(e) and + kind = e and + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) + ) ) } @@ -118,13 +121,42 @@ abstract class TranslatedCall extends TranslatedExpr { /** * Holds if the evaluation of this call may throw an exception. + * The edge `e` determines what type of exception is being considered, + * `CppExceptionEdge` or `SehExceptionEdge`. */ - abstract predicate mayThrowException(); + abstract predicate mayThrowException(ExceptionEdge e); /** * Holds if the evaluation of this call always throws an exception. + * The edge `e` determines what type of exception is being considered, + * `CppExceptionEdge` or `SehExceptionEdge`. + */ + abstract predicate mustThrowException(ExceptionEdge e); + + /** + * Holds when the call target is known to never raise an exception. + * The edge `e` determines what type of exception is being considered, + * `CppExceptionEdge` or `SehExceptionEdge`. + * + * Note that `alwaysRaiseException`, `mayRaiseException`, + * and `neverRaiseException` may conflict (e.g., all hold for a given target). + * Conflicting results are resolved during IR generation. + */ + abstract predicate neverThrowException(ExceptionEdge e); + + /** + * Holds if the call has any exception behavior defined for exception edge type `e`, + * i.e., if the function is known to throw or never throw an exception. + * This handles cases where a function has no annotation to specify + * if a function throws or doesn't throw. */ - abstract predicate mustThrowException(); + final predicate hasExceptionBehavior(ExceptionEdge e) { + this.mayThrowException(e) + or + this.mustThrowException(e) + or + this.neverThrowException(e) + } /** * Gets the result type of the call. @@ -320,6 +352,32 @@ abstract class TranslatedCallExpr extends TranslatedNonConstantExpr, TranslatedC final override int getNumberOfArguments() { result = expr.getNumberOfArguments() } final override predicate isNoReturn() { any(Options opt).exits(expr.getTarget()) } + + override predicate mustThrowException(ExceptionEdge e) { + // Functions that always raise exceptions only occur with Seh exceptions + // Use the `AlwaysSehThrowingFunction` instance unless the function is known to never throw + not this.neverThrowException(e) and + expr.getTarget() instanceof AlwaysSehThrowingFunction and + e instanceof SehExceptionEdge + } + + override predicate mayThrowException(ExceptionEdge e) { + // by default, all functions may throw exceptions of any kind + // unless explicitly annotated to never throw + not this.neverThrowException(e) and + // for now assuming all calls may throw for Seh only + e instanceof SehExceptionEdge + } + + override predicate neverThrowException(ExceptionEdge e) { + // currently, only functions can only explicitly stipulate they + // never through a C++ exception + // NOTE: we cannot simply check if not exists may and must throw. + // since an annotation exists to override any other behavior + // i.e., `NonCppThrowingFunction`. + e instanceof CppExceptionEdge and + expr.getTarget() instanceof NonCppThrowingFunction + } } /** @@ -332,14 +390,16 @@ class TranslatedExprCall extends TranslatedCallExpr { result = getTranslatedExpr(expr.getExpr().getFullyConverted()) } - final override predicate mayThrowException() { + final override predicate mayThrowException(ExceptionEdge e) { none() } + + final override predicate mustThrowException(ExceptionEdge e) { none() } + + final override predicate neverThrowException(ExceptionEdge e) { // We assume that a call to a function pointer will not throw an exception. // This is not sound in general, but this will greatly reduce the number of // exceptional edges. - none() + any() } - - final override predicate mustThrowException() { none() } } /** @@ -361,18 +421,6 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall { exists(this.getQualifier()) and not exists(MemberFunction func | expr.getTarget() = func and func.isStatic()) } - - final override predicate mayThrowException() { - expr.getTarget().(ThrowingFunction).mayThrowException(_) - or - expr.getTarget() instanceof AlwaysSehThrowingFunction - } - - final override predicate mustThrowException() { - expr.getTarget().(ThrowingFunction).mayThrowException(true) - or - expr.getTarget() instanceof AlwaysSehThrowingFunction - } } /** 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 8e7e46c94c62..b279624afea0 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 @@ -1107,8 +1107,8 @@ abstract class TranslatedElement extends TTranslatedElement { * nearest enclosing `try`, or the `Unwind` instruction for the function if * there is no enclosing `try`. The successor edge kind is specified by `kind`. */ - Instruction getExceptionSuccessorInstruction(EdgeKind kind) { - result = this.getParent().getExceptionSuccessorInstruction(kind) + Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + result = this.getParent().getExceptionSuccessorInstruction(kind, exception) } /** 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 573df94a740e..db46c5dcd124 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 @@ -15,6 +15,7 @@ private import TranslatedInitialization private import TranslatedStmt private import TranslatedGlobalVar private import IRConstruction +private import EdgeKind import TranslatedCall /** @@ -2375,14 +2376,16 @@ class TranslatedAllocatorCall extends TTranslatedAllocatorCall, TranslatedDirect result = getTranslatedExpr(expr.getAllocatorCall().getArgument(index).getFullyConverted()) } - final override predicate mayThrowException() { + final override predicate mayThrowException(ExceptionEdge e) { none() } + + final override predicate mustThrowException(ExceptionEdge e) { none() } + + final override predicate neverThrowException(ExceptionEdge e) { // We assume that a call to `new` or `new[]` will never throw. This is not // sound in general, but this will greatly reduce the number of exceptional // edges. - none() + any() } - - final override predicate mustThrowException() { none() } } TranslatedAllocatorCall getTranslatedAllocatorCall(NewOrNewArrayExpr newExpr) { @@ -2448,14 +2451,16 @@ class TranslatedDeleteOrDeleteArrayExpr extends TranslatedNonConstantExpr, Trans result = getTranslatedExpr(expr.getExprWithReuse().getFullyConverted()) } - final override predicate mayThrowException() { + final override predicate mayThrowException(ExceptionEdge e) { none() } + + final override predicate mustThrowException(ExceptionEdge e) { none() } + + final override predicate neverThrowException(ExceptionEdge e) { // We assume that a call to `delete` or `delete[]` will never throw. This is not // sound in general, but this will greatly reduce the number of exceptional // edges. - none() + any() } - - final override predicate mustThrowException() { none() } } TranslatedDeleteOrDeleteArrayExpr getTranslatedDeleteOrDeleteArray(DeleteOrDeleteArrayExpr newExpr) { @@ -3040,7 +3045,7 @@ class TranslatedDestructorsAfterThrow extends TranslatedElement, TTranslatedDest // And otherwise, exit this element with an exceptional edge not exists(this.getChild(id + 1)) and kind instanceof CppExceptionEdge and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) ) } @@ -3079,7 +3084,7 @@ abstract class TranslatedThrowExpr extends TranslatedNonConstantExpr { or not exists(this.getDestructors()) and kind instanceof CppExceptionEdge and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) ) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll index 57f718bcb6ab..1002317612ef 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll @@ -209,12 +209,14 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { ( // Only generate the `Unwind` instruction if there is any exception // handling present in the function. - exists(TryOrMicrosoftTryStmt try | try.getEnclosingFunction() = func) + // Do not unwind for MicrosoftTryStmt (SEH), as an optimization (SEH exception + // will occur at any store/load, so unwind would appear everywhere as a result) + exists(TryStmt try | try.getEnclosingFunction() = func) or exists(ThrowExpr throw | throw.getEnclosingFunction() = func) or - exists(FunctionCall call | call.getEnclosingFunction() = func | - getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException() + exists(FunctionCall call, CppExceptionEdge exception | call.getEnclosingFunction() = func | + getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException(exception) ) ) or @@ -228,7 +230,10 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { ) } - final override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + final override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + // only unwind for C++ exceptions since SEH exceptions are too verbose + // and would generate unwind for all functions. + exception instanceof CppExceptionEdge and result = this.getInstruction(UnwindTag()) and kind instanceof GotoEdge } 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 e0c7d625e81c..c1628dffeb5e 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 @@ -10,6 +10,7 @@ private import TranslatedElement private import TranslatedExpr private import TranslatedFunction private import TranslatedInitialization +private import EdgeKind TranslatedStmt getTranslatedStmt(Stmt stmt) { result.getAst() = stmt } @@ -151,7 +152,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, // TODO: This is not really correct. The semantics of `EXCEPTION_CONTINUE_EXECUTION` is that // we should continue execution at the point where the exception occurred. But we don't have // any instruction to model this behavior. - result = this.getExceptionSuccessorInstruction(any(GotoEdge edge)) + result = this.getExceptionSuccessorInstruction(any(GotoEdge edge), sehExceptionEdge()) or kind instanceof FalseEdge and result = this.getInstruction(TryExceptGenerateZero()) @@ -171,7 +172,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, tag = TryExceptCompareZeroBranch() and ( kind instanceof TrueEdge and - result = this.getExceptionSuccessorInstruction(any(GotoEdge edge)) + result = this.getExceptionSuccessorInstruction(any(GotoEdge edge), sehExceptionEdge()) or kind instanceof FalseEdge and result = this.getInstruction(TryExceptGenerateOne()) @@ -226,10 +227,10 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, final override Function getFunction() { result = tryExcept.getEnclosingFunction() } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { // A throw from within a `__except` block flows to the handler for the parent of // the `__try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) } } @@ -282,10 +283,10 @@ class TranslatedMicrosoftTryFinallyHandler extends TranslatedElement, result = getTranslatedStmt(tryFinally.getFinally()) } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { // A throw from within a `__finally` block flows to the handler for the parent of // the `__try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) } } @@ -734,14 +735,32 @@ class TranslatedTryStmt extends TranslatedStmt { // of the `try`, because the exception successor of the `try` itself is // the first catch clause. handler = this.getHandler(stmt.getNumberOfCatchClauses() - 1) and - result = this.getParent().getExceptionSuccessorInstruction(kind) + exists(ExceptionEdge exception | + stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge + or + stmt instanceof TryStmt and exception instanceof CppExceptionEdge + | + result = this.getParent().getExceptionSuccessorInstruction(kind, exception) + ) } - final override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { - result = this.getHandler(0).getFirstInstruction(kind) - or - not exists(this.getHandler(_)) and - result = this.getFinally().getFirstInstruction(kind) + final override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + // Seh exceptions are only handled for Seh try statements and + // C++ exceptions for C++ try statements. + // I.e., we are assuming there isn't a mix and match between Seh and C++ exceptions. + // They are either all Seh or all C++ within a single try block depending on the + // try type (TryStmt vs MicrosoftTryStmt). + ( + stmt instanceof TryStmt and exception instanceof CppExceptionEdge + or + stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge + ) and + ( + result = this.getHandler(0).getFirstInstruction(kind) + or + not exists(this.getHandler(_)) and + result = this.getFinally().getFirstInstruction(kind) + ) } private TranslatedElement getHandler(int index) { result = stmt.getTranslatedHandler(index) } @@ -821,10 +840,10 @@ abstract class TranslatedHandler extends TranslatedStmt { child = this.getBlock() and result = this.getParent().getChildSuccessor(this, kind) } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { // A throw from within a `catch` block flows to the handler for the parent of // the `try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) } TranslatedStmt getBlock() { result = getTranslatedStmt(stmt.getBlock()) } diff --git a/cpp/ql/lib/semmle/code/cpp/models/interfaces/Throwing.qll b/cpp/ql/lib/semmle/code/cpp/models/interfaces/Throwing.qll index cc2948067092..e9279a109ad9 100644 --- a/cpp/ql/lib/semmle/code/cpp/models/interfaces/Throwing.qll +++ b/cpp/ql/lib/semmle/code/cpp/models/interfaces/Throwing.qll @@ -12,8 +12,14 @@ import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs /** * A function that is known to raise an exception. + * + * DEPRECATED: This was originally used to differentiate Seh and C++ exception use. + * `AlwaysSehThrowingFunction` should be used instead for Seh exceptions that are + * known to always throw and + * `NonCppThrowingFunction` in `semmle.code.cpp.models.interfaces.NonThrowing` + * should be used for C++ exceptions that are known to never throw. */ -abstract class ThrowingFunction extends Function { +abstract deprecated class ThrowingFunction extends Function { /** * Holds if this function may throw an exception during evaluation. * If `unconditional` is `true` the function always throws an exception. From 52e16479ca5edabfd600264528d3509a006d7839 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 11:11:32 -0500 Subject: [PATCH 2/9] Updating test cases. --- .../library-tests/ir/ir/aliased_ir.expected | 361 +++++++++------ .../ir/ir/aliased_ssa_consistency.expected | 4 + .../aliased_ssa_consistency_unsound.expected | 4 + .../ir/ir/raw_consistency.expected | 14 +- .../test/library-tests/ir/ir/raw_ir.expected | 430 +++++++----------- .../ir/ir/unaliased_ssa_consistency.expected | 4 + ...unaliased_ssa_consistency_unsound.expected | 4 + 7 files changed, 417 insertions(+), 404 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected index 224ac9a0ed9b..a9e623633674 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected @@ -3120,7 +3120,7 @@ ir.c: # 25| v25_4(void) = Call[ExRaiseAccessViolation] : func:r25_1, 0:r25_3 # 25| m25_5(unknown) = ^CallSideEffect : ~m21_4 # 25| m25_6(unknown) = Chi : total:m21_4, partial:m25_5 -#-----| C++ Exception -> Block 3 +#-----| SEH Exception -> Block 3 # 26| Block 1 # 26| r26_1(int) = Constant[0] : @@ -3167,45 +3167,39 @@ ir.c: # 36| v36_3(void) = Call[ExRaiseAccessViolation] : func:r36_1, 0:r36_2 # 36| m36_4(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_5(unknown) = Chi : total:m32_4, partial:m36_4 -#-----| C++ Exception -> Block 4 - -# 32| Block 1 -# 32| v32_5(void) = Unwind : -# 32| v32_6(void) = AliasedUse : ~m40_5 -# 32| v32_7(void) = ExitFunction : +#-----| SEH Exception -> Block 3 -# 39| Block 2 +# 39| Block 1 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r38_1, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 3 -#-----| True -> Block 6 +#-----| False -> Block 2 +#-----| True -> Block 5 -# 39| Block 3 +# 39| Block 2 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r38_1, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| False -> Block 6 -#-----| True -> Block 5 +#-----| False -> Block 5 +#-----| True -> Block 4 -# 38| Block 4 +# 38| Block 3 # 38| r38_1(int) = Constant[1] : # 39| r39_7(int) = Constant[-1] : # 39| r39_8(bool) = CompareEQ : r38_1, r39_7 # 39| v39_9(void) = ConditionalBranch : r39_8 -#-----| False -> Block 2 -#-----| True -> Block 6 +#-----| False -> Block 1 +#-----| True -> Block 5 -# 40| Block 5 +# 40| Block 4 # 40| r40_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 40| r40_2(int) = Constant[1] : # 40| v40_3(void) = Call[ExRaiseAccessViolation] : func:r40_1, 0:r40_2 # 40| m40_4(unknown) = ^CallSideEffect : ~m36_5 # 40| m40_5(unknown) = Chi : total:m36_5, partial:m40_4 -#-----| C++ Exception -> Block 1 -# 32| Block 6 -# 32| v32_8(void) = Unreached : +# 32| Block 5 +# 32| v32_5(void) = Unreached : # 44| void try_with_finally() # 44| Block 0 @@ -3241,7 +3235,7 @@ ir.c: # 62| v62_3(void) = Call[ExRaiseAccessViolation] : func:r62_1, 0:r62_2 # 62| m62_4(unknown) = ^CallSideEffect : ~m57_4 # 62| m62_5(unknown) = Chi : total:m57_4, partial:m62_4 -#-----| C++ Exception -> Block 1 +#-----| SEH Exception -> Block 1 # 66| Block 1 # 66| r66_1(int) = Constant[1] : @@ -3263,20 +3257,14 @@ ir.c: # 73| v73_3(void) = Call[ExRaiseAccessViolation] : func:r73_1, 0:r73_2 # 73| m73_4(unknown) = ^CallSideEffect : ~m70_4 # 73| m73_5(unknown) = Chi : total:m70_4, partial:m73_4 -#-----| C++ Exception -> Block 2 +#-----| SEH Exception -> Block 1 -# 70| Block 1 -# 70| v70_5(void) = Unwind : -# 70| v70_6(void) = AliasedUse : ~m76_5 -# 70| v70_7(void) = ExitFunction : - -# 76| Block 2 +# 76| Block 1 # 76| r76_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 76| r76_2(int) = Constant[0] : # 76| v76_3(void) = Call[ExRaiseAccessViolation] : func:r76_1, 0:r76_2 # 76| m76_4(unknown) = ^CallSideEffect : ~m73_5 # 76| m76_5(unknown) = Chi : total:m73_5, partial:m76_4 -#-----| C++ Exception -> Block 1 # 80| void raise_access_violation() # 80| Block 0 @@ -3289,12 +3277,6 @@ ir.c: # 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2 # 81| m81_4(unknown) = ^CallSideEffect : ~m80_4 # 81| m81_5(unknown) = Chi : total:m80_4, partial:m81_4 -#-----| C++ Exception -> Block 1 - -# 80| Block 1 -# 80| v80_5(void) = Unwind : -# 80| v80_6(void) = AliasedUse : ~m81_5 -# 80| v80_7(void) = ExitFunction : # 84| void branch_on_integral_in_c(int, int) # 84| Block 0 @@ -38731,20 +38713,24 @@ struct_init.cpp: try_except.c: # 6| void f() # 6| Block 0 -# 6| v6_1(void) = EnterFunction : -# 6| m6_2(unknown) = AliasedDefinition : -# 6| m6_3(unknown) = InitializeNonLocal : -# 6| m6_4(unknown) = Chi : total:m6_2, partial:m6_3 -# 7| r7_1(glval) = VariableAddress[x] : -# 7| m7_2(int) = Uninitialized[x] : &:r7_1 -# 7| r7_3(glval) = VariableAddress[y] : -# 7| r7_4(int) = Constant[0] : -# 7| m7_5(int) = Store[y] : &:r7_3, r7_4 -# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : -# 9| r9_2(int) = Constant[0] : -# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 -# 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 -# 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +# 6| v6_1(void) = EnterFunction : +# 6| m6_2(unknown) = AliasedDefinition : +# 6| m6_3(unknown) = InitializeNonLocal : +# 6| m6_4(unknown) = Chi : total:m6_2, partial:m6_3 +# 7| r7_1(glval) = VariableAddress[x] : +# 7| m7_2(int) = Uninitialized[x] : &:r7_1 +# 7| r7_3(glval) = VariableAddress[y] : +# 7| r7_4(int) = Constant[0] : +# 7| m7_5(int) = Store[y] : &:r7_3, r7_4 +# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : +# 9| r9_2(int) = Constant[0] : +# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 +# 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 +# 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 3 + +# 10| Block 1 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, m7_5 # 10| r10_3(glval) = VariableAddress[x] : @@ -38754,12 +38740,30 @@ try_except.c: # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| m11_4(unknown) = ^CallSideEffect : ~m9_5 # 11| m11_5(unknown) = Chi : total:m9_5, partial:m11_4 -# 16| v16_1(void) = NoOp : -# 6| v6_5(void) = ReturnVoid : -# 6| v6_6(void) = AliasedUse : ~m11_5 -# 6| v6_7(void) = ExitFunction : +#-----| Goto -> Block 4 +#-----| SEH Exception -> Block 3 -# 6| Block 1 +# 13| Block 2 +# 13| r13_1(int) = Constant[0] : +# 13| r13_2(bool) = CompareEQ : r13_4, r13_1 +# 13| v13_3(void) = ConditionalBranch : r13_2 +#-----| False -> Block 5 + +# 13| Block 3 +# 13| r13_4(int) = Constant[0] : +# 13| r13_5(int) = Constant[-1] : +# 13| r13_6(bool) = CompareEQ : r13_4, r13_5 +# 13| v13_7(void) = ConditionalBranch : r13_6 +#-----| False -> Block 2 +#-----| True -> Block 5 + +# 16| Block 4 +# 16| v16_1(void) = NoOp : +# 6| v6_5(void) = ReturnVoid : +# 6| v6_6(void) = AliasedUse : ~m11_5 +# 6| v6_7(void) = ExitFunction : + +# 6| Block 5 # 6| v6_8(void) = Unreached : # 18| void g() @@ -38778,6 +38782,10 @@ try_except.c: # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| m21_4(unknown) = ^CallSideEffect : ~m18_4 # 21| m21_5(unknown) = Chi : total:m18_4, partial:m21_4 +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 22| Block 1 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, m19_5 # 22| r22_3(glval) = VariableAddress[x] : @@ -38787,16 +38795,21 @@ try_except.c: # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| m23_4(unknown) = ^CallSideEffect : ~m21_5 # 23| m23_5(unknown) = Chi : total:m21_5, partial:m23_4 -# 26| r26_1(glval) = FunctionAddress[sink] : -# 26| r26_2(glval) = VariableAddress[x] : -# 26| r26_3(int) = Load[x] : &:r26_2, m22_4 -# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 -# 26| m26_5(unknown) = ^CallSideEffect : ~m23_5 -# 26| m26_6(unknown) = Chi : total:m23_5, partial:m26_5 -# 28| v28_1(void) = NoOp : -# 18| v18_5(void) = ReturnVoid : -# 18| v18_6(void) = AliasedUse : ~m26_6 -# 18| v18_7(void) = ExitFunction : +#-----| SEH Exception -> Block 2 + +# 26| Block 2 +# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 1:~m23_5 +# 26| m26_2(int) = Phi : from 0:m19_2, from 1:m22_4 +# 26| r26_3(glval) = FunctionAddress[sink] : +# 26| r26_4(glval) = VariableAddress[x] : +# 26| r26_5(int) = Load[x] : &:r26_4, m26_2 +# 26| v26_6(void) = Call[sink] : func:r26_3, 0:r26_5 +# 26| m26_7(unknown) = ^CallSideEffect : ~m26_1 +# 26| m26_8(unknown) = Chi : total:m26_1, partial:m26_7 +# 28| v28_1(void) = NoOp : +# 18| v18_5(void) = ReturnVoid : +# 18| v18_6(void) = AliasedUse : ~m26_8 +# 18| v18_7(void) = ExitFunction : # 32| void h(int) # 32| Block 0 @@ -38812,7 +38825,7 @@ try_except.c: # 35| r35_1(glval) = VariableAddress[b] : # 35| r35_2(int) = Load[b] : &:r35_1, m32_6 # 35| v35_3(void) = ConditionalBranch : r35_2 -#-----| False -> Block 2 +#-----| False -> Block 6 #-----| True -> Block 1 # 36| Block 1 @@ -38820,35 +38833,71 @@ try_except.c: # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| m36_3(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_4(unknown) = Chi : total:m32_4, partial:m36_3 -#-----| Goto -> Block 2 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 42| Block 2 -# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4 +# 39| Block 2 +# 39| r39_1(int) = Constant[0] : +# 39| r39_2(bool) = CompareEQ : r39_7, r39_1 +# 39| v39_3(void) = ConditionalBranch : r39_2 +#-----| False -> Block 3 +#-----| True -> Block 7 + +# 39| Block 3 +# 39| r39_4(int) = Constant[1] : +# 39| r39_5(bool) = CompareEQ : r39_7, r39_4 +# 39| v39_6(void) = ConditionalBranch : r39_5 +#-----| False -> Block 7 +#-----| True -> Block 5 + +# 39| Block 4 +# 39| r39_7(int) = Constant[1] : +# 39| r39_8(int) = Constant[-1] : +# 39| r39_9(bool) = CompareEQ : r39_7, r39_8 +# 39| v39_10(void) = ConditionalBranch : r39_9 +#-----| False -> Block 2 +#-----| True -> Block 7 + +# 40| Block 5 +# 40| r40_1(glval) = FunctionAddress[sink] : +# 40| r40_2(glval) = VariableAddress[x] : +# 40| r40_3(int) = Load[x] : &:r40_2, m33_3 +# 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 +# 40| m40_5(unknown) = ^CallSideEffect : ~m36_4 +# 40| m40_6(unknown) = Chi : total:m36_4, partial:m40_5 +#-----| Goto -> Block 6 + +# 42| Block 6 +# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4, from 5:~m40_6 # 42| v42_2(void) = NoOp : # 32| v32_7(void) = ReturnVoid : # 32| v32_8(void) = AliasedUse : ~m42_1 # 32| v32_9(void) = ExitFunction : -# 32| Block 3 +# 32| Block 7 # 32| v32_10(void) = Unreached : try_except.cpp: # 6| void f_cpp() # 6| Block 0 -# 6| v6_1(void) = EnterFunction : -# 6| m6_2(unknown) = AliasedDefinition : -# 6| m6_3(unknown) = InitializeNonLocal : -# 6| m6_4(unknown) = Chi : total:m6_2, partial:m6_3 -# 7| r7_1(glval) = VariableAddress[x] : -# 7| m7_2(int) = Uninitialized[x] : &:r7_1 -# 7| r7_3(glval) = VariableAddress[y] : -# 7| r7_4(int) = Constant[0] : -# 7| m7_5(int) = Store[y] : &:r7_3, r7_4 -# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : -# 9| r9_2(int) = Constant[0] : -# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 -# 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 -# 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +# 6| v6_1(void) = EnterFunction : +# 6| m6_2(unknown) = AliasedDefinition : +# 6| m6_3(unknown) = InitializeNonLocal : +# 6| m6_4(unknown) = Chi : total:m6_2, partial:m6_3 +# 7| r7_1(glval) = VariableAddress[x] : +# 7| m7_2(int) = Uninitialized[x] : &:r7_1 +# 7| r7_3(glval) = VariableAddress[y] : +# 7| r7_4(int) = Constant[0] : +# 7| m7_5(int) = Store[y] : &:r7_3, r7_4 +# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : +# 9| r9_2(int) = Constant[0] : +# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 +# 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 +# 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 3 + +# 10| Block 1 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, m7_5 # 10| r10_3(glval) = VariableAddress[x] : @@ -38858,12 +38907,30 @@ try_except.cpp: # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| m11_4(unknown) = ^CallSideEffect : ~m9_5 # 11| m11_5(unknown) = Chi : total:m9_5, partial:m11_4 -# 16| v16_1(void) = NoOp : -# 6| v6_5(void) = ReturnVoid : -# 6| v6_6(void) = AliasedUse : ~m11_5 -# 6| v6_7(void) = ExitFunction : +#-----| Goto -> Block 4 +#-----| SEH Exception -> Block 3 -# 6| Block 1 +# 13| Block 2 +# 13| r13_1(int) = Constant[0] : +# 13| r13_2(bool) = CompareEQ : r13_4, r13_1 +# 13| v13_3(void) = ConditionalBranch : r13_2 +#-----| False -> Block 5 + +# 13| Block 3 +# 13| r13_4(int) = Constant[0] : +# 13| r13_5(int) = Constant[-1] : +# 13| r13_6(bool) = CompareEQ : r13_4, r13_5 +# 13| v13_7(void) = ConditionalBranch : r13_6 +#-----| False -> Block 2 +#-----| True -> Block 5 + +# 16| Block 4 +# 16| v16_1(void) = NoOp : +# 6| v6_5(void) = ReturnVoid : +# 6| v6_6(void) = AliasedUse : ~m11_5 +# 6| v6_7(void) = ExitFunction : + +# 6| Block 5 # 6| v6_8(void) = Unreached : # 18| void g_cpp() @@ -38882,6 +38949,10 @@ try_except.cpp: # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| m21_4(unknown) = ^CallSideEffect : ~m18_4 # 21| m21_5(unknown) = Chi : total:m18_4, partial:m21_4 +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 22| Block 1 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, m19_5 # 22| r22_3(glval) = VariableAddress[x] : @@ -38891,16 +38962,21 @@ try_except.cpp: # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| m23_4(unknown) = ^CallSideEffect : ~m21_5 # 23| m23_5(unknown) = Chi : total:m21_5, partial:m23_4 -# 26| r26_1(glval) = FunctionAddress[sink] : -# 26| r26_2(glval) = VariableAddress[x] : -# 26| r26_3(int) = Load[x] : &:r26_2, m22_4 -# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 -# 26| m26_5(unknown) = ^CallSideEffect : ~m23_5 -# 26| m26_6(unknown) = Chi : total:m23_5, partial:m26_5 -# 28| v28_1(void) = NoOp : -# 18| v18_5(void) = ReturnVoid : -# 18| v18_6(void) = AliasedUse : ~m26_6 -# 18| v18_7(void) = ExitFunction : +#-----| SEH Exception -> Block 2 + +# 26| Block 2 +# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 1:~m23_5 +# 26| m26_2(int) = Phi : from 0:m19_2, from 1:m22_4 +# 26| r26_3(glval) = FunctionAddress[sink] : +# 26| r26_4(glval) = VariableAddress[x] : +# 26| r26_5(int) = Load[x] : &:r26_4, m26_2 +# 26| v26_6(void) = Call[sink] : func:r26_3, 0:r26_5 +# 26| m26_7(unknown) = ^CallSideEffect : ~m26_1 +# 26| m26_8(unknown) = Chi : total:m26_1, partial:m26_7 +# 28| v28_1(void) = NoOp : +# 18| v18_5(void) = ReturnVoid : +# 18| v18_6(void) = AliasedUse : ~m26_8 +# 18| v18_7(void) = ExitFunction : # 32| void h_cpp(int) # 32| Block 0 @@ -38918,7 +38994,7 @@ try_except.cpp: # 35| r35_3(int) = Constant[0] : # 35| r35_4(bool) = CompareNE : r35_2, r35_3 # 35| v35_5(void) = ConditionalBranch : r35_4 -#-----| False -> Block 2 +#-----| False -> Block 6 #-----| True -> Block 1 # 36| Block 1 @@ -38926,16 +39002,48 @@ try_except.cpp: # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| m36_3(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_4(unknown) = Chi : total:m32_4, partial:m36_3 -#-----| Goto -> Block 2 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 42| Block 2 -# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4 +# 39| Block 2 +# 39| r39_1(int) = Constant[0] : +# 39| r39_2(bool) = CompareEQ : r39_7, r39_1 +# 39| v39_3(void) = ConditionalBranch : r39_2 +#-----| False -> Block 3 +#-----| True -> Block 7 + +# 39| Block 3 +# 39| r39_4(int) = Constant[1] : +# 39| r39_5(bool) = CompareEQ : r39_7, r39_4 +# 39| v39_6(void) = ConditionalBranch : r39_5 +#-----| False -> Block 7 +#-----| True -> Block 5 + +# 39| Block 4 +# 39| r39_7(int) = Constant[1] : +# 39| r39_8(int) = Constant[-1] : +# 39| r39_9(bool) = CompareEQ : r39_7, r39_8 +# 39| v39_10(void) = ConditionalBranch : r39_9 +#-----| False -> Block 2 +#-----| True -> Block 7 + +# 40| Block 5 +# 40| r40_1(glval) = FunctionAddress[sink] : +# 40| r40_2(glval) = VariableAddress[x] : +# 40| r40_3(int) = Load[x] : &:r40_2, m33_3 +# 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 +# 40| m40_5(unknown) = ^CallSideEffect : ~m36_4 +# 40| m40_6(unknown) = Chi : total:m36_4, partial:m40_5 +#-----| Goto -> Block 6 + +# 42| Block 6 +# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4, from 5:~m40_6 # 42| v42_2(void) = NoOp : # 32| v32_7(void) = ReturnVoid : # 32| v32_8(void) = AliasedUse : ~m42_1 # 32| v32_9(void) = ExitFunction : -# 32| Block 3 +# 32| Block 7 # 32| v32_10(void) = Unreached : # 44| void throw_cpp(int) @@ -38954,7 +39062,7 @@ try_except.cpp: # 47| r47_3(int) = Constant[0] : # 47| r47_4(bool) = CompareNE : r47_2, r47_3 # 47| v47_5(void) = ConditionalBranch : r47_4 -#-----| False -> Block 6 +#-----| False -> Block 2 #-----| True -> Block 1 # 48| Block 1 @@ -38962,45 +39070,12 @@ try_except.cpp: # 48| r48_2(int) = Constant[1] : # 48| m48_3(int) = Store[#throw48:13] : &:r48_1, r48_2 # 48| v48_4(void) = ThrowValue : &:r48_1, m48_3 -#-----| C++ Exception -> Block 4 -# 51| Block 2 -# 51| r51_1(int) = Constant[0] : -# 51| r51_2(bool) = CompareEQ : r51_7, r51_1 -# 51| v51_3(void) = ConditionalBranch : r51_2 -#-----| False -> Block 3 -#-----| True -> Block 7 - -# 51| Block 3 -# 51| r51_4(int) = Constant[1] : -# 51| r51_5(bool) = CompareEQ : r51_7, r51_4 -# 51| v51_6(void) = ConditionalBranch : r51_5 -#-----| False -> Block 7 -#-----| True -> Block 5 - -# 51| Block 4 -# 51| r51_7(int) = Constant[1] : -# 51| r51_8(int) = Constant[-1] : -# 51| r51_9(bool) = CompareEQ : r51_7, r51_8 -# 51| v51_10(void) = ConditionalBranch : r51_9 -#-----| False -> Block 2 -#-----| True -> Block 7 - -# 52| Block 5 -# 52| r52_1(glval) = FunctionAddress[sink] : -# 52| r52_2(glval) = VariableAddress[x] : -# 52| r52_3(int) = Load[x] : &:r52_2, m45_3 -# 52| v52_4(void) = Call[sink] : func:r52_1, 0:r52_3 -# 52| m52_5(unknown) = ^CallSideEffect : ~m44_4 -# 52| m52_6(unknown) = Chi : total:m44_4, partial:m52_5 -#-----| Goto -> Block 6 - -# 54| Block 6 -# 54| m54_1(unknown) = Phi : from 0:~m44_4, from 5:~m52_6 -# 54| v54_2(void) = NoOp : -# 44| v44_7(void) = ReturnVoid : -# 44| v44_8(void) = AliasedUse : ~m54_1 -# 44| v44_9(void) = ExitFunction : +# 54| Block 2 +# 54| v54_1(void) = NoOp : +# 44| v44_7(void) = ReturnVoid : +# 44| v44_8(void) = AliasedUse : m44_3 +# 44| v44_9(void) = ExitFunction : -# 44| Block 7 +# 44| Block 3 # 44| v44_10(void) = Unreached : diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 7f10f2f9d7c9..4cc867601938 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -6,6 +6,10 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ir.c:40:5:40:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | +| ir.c:76:5:76:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | +| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | +| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 7f10f2f9d7c9..4cc867601938 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -6,6 +6,10 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ir.c:40:5:40:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | +| ir.c:76:5:76:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | +| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | +| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 7b5d32c65438..d83aeff705b2 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -6,6 +6,10 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | +| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | +| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | +| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction @@ -21,14 +25,8 @@ lostReachability backEdgeCountMismatch useNotDominatedByDefinition | ir.cpp:1535:8:1535:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1535:8:1535:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | -| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() | -| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() | -| try_except.c:39:15:39:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:32:6:32:6 | void h(int) | void h(int) | -| try_except.c:39:15:39:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:32:6:32:6 | void h(int) | void h(int) | -| try_except.cpp:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:6:6:6:10 | void f_cpp() | void f_cpp() | -| try_except.cpp:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:6:6:6:10 | void f_cpp() | void f_cpp() | -| try_except.cpp:39:15:39:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:32:6:32:10 | void h_cpp(int) | void h_cpp(int) | -| try_except.cpp:39:15:39:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:32:6:32:10 | void h_cpp(int) | void h_cpp(int) | +| try_except.cpp:51:15:51:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | +| try_except.cpp:51:15:51:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated 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 8600049dd225..da23ac98c56d 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -2884,53 +2884,44 @@ ir.c: # 25| r25_3(int) = Load[x] : &:r25_2, ~m? # 25| v25_4(void) = Call[ExRaiseAccessViolation] : func:r25_1, 0:r25_3 # 25| mu25_5(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 6 +#-----| SEH Exception -> Block 4 # 21| Block 1 -# 21| v21_6(void) = AliasedUse : ~m? -# 21| v21_7(void) = ExitFunction : +# 21| r21_6(glval) = VariableAddress[#return] : +# 21| v21_7(void) = ReturnValue : &:r21_6, ~m? +# 21| v21_8(void) = AliasedUse : ~m? +# 21| v21_9(void) = ExitFunction : -# 21| Block 2 -# 21| r21_8(glval) = VariableAddress[#return] : -# 21| v21_9(void) = ReturnValue : &:r21_8, ~m? -#-----| Goto -> Block 1 - -# 21| Block 3 -# 21| v21_10(void) = Unwind : -#-----| Goto -> Block 1 - -# 26| Block 4 +# 26| Block 2 # 26| r26_1(int) = Constant[0] : # 26| r26_2(bool) = CompareEQ : r26_7, r26_1 # 26| v26_3(void) = ConditionalBranch : r26_2 -#-----| False -> Block 5 -#-----| True -> Block 3 +#-----| False -> Block 3 -# 26| Block 5 +# 26| Block 3 # 26| r26_4(int) = Constant[1] : # 26| r26_5(bool) = CompareEQ : r26_7, r26_4 # 26| v26_6(void) = ConditionalBranch : r26_5 -#-----| True -> Block 7 +#-----| True -> Block 5 -# 26| Block 6 +# 26| Block 4 # 26| r26_7(int) = Constant[1] : # 26| r26_8(int) = Constant[-1] : # 26| r26_9(bool) = CompareEQ : r26_7, r26_8 # 26| v26_10(void) = ConditionalBranch : r26_9 -#-----| False -> Block 4 -#-----| True -> Block 3 +#-----| False -> Block 2 -# 27| Block 7 +# 27| Block 5 # 27| r27_1(glval) = VariableAddress[#return] : # 27| r27_2(int) = Constant[1] : # 27| mu27_3(int) = Store[#return] : &:r27_1, r27_2 -#-----| Goto -> Block 2 +#-----| Goto -> Block 1 -# 29| Block 8 +# 29| Block 6 # 29| r29_1(glval) = VariableAddress[#return] : # 29| r29_2(int) = Constant[0] : # 29| mu29_3(int) = Store[#return] : &:r29_1, r29_2 -#-----| Goto -> Block 2 +#-----| Goto -> Block 1 # 32| void unexplained_loop_regression() # 32| Block 0 @@ -2941,48 +2932,38 @@ ir.c: # 36| r36_2(int) = Constant[0] : # 36| v36_3(void) = Call[ExRaiseAccessViolation] : func:r36_1, 0:r36_2 # 36| mu36_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 5 - -# 32| Block 1 -# 32| v32_4(void) = AliasedUse : ~m? -# 32| v32_5(void) = ExitFunction : - -# 32| Block 2 -# 32| v32_6(void) = Unwind : -#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 3 -# 39| Block 3 +# 39| Block 1 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r38_1, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 4 -#-----| True -> Block 2 +#-----| False -> Block 2 -# 39| Block 4 +# 39| Block 2 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r38_1, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 6 +#-----| True -> Block 4 -# 38| Block 5 +# 38| Block 3 # 38| r38_1(int) = Constant[1] : # 39| r39_7(int) = Constant[-1] : # 39| r39_8(bool) = CompareEQ : r38_1, r39_7 # 39| v39_9(void) = ConditionalBranch : r39_8 -#-----| False -> Block 3 -#-----| True -> Block 2 +#-----| False -> Block 1 -# 40| Block 6 +# 40| Block 4 # 40| r40_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 40| r40_2(int) = Constant[1] : # 40| v40_3(void) = Call[ExRaiseAccessViolation] : func:r40_1, 0:r40_2 # 40| mu40_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 2 -# 42| Block 7 -# 42| v42_1(void) = NoOp : -# 32| v32_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 42| Block 5 +# 42| v42_1(void) = NoOp : +# 32| v32_4(void) = ReturnVoid : +# 32| v32_5(void) = AliasedUse : ~m? +# 32| v32_6(void) = ExitFunction : # 44| void try_with_finally() # 44| Block 0 @@ -3000,15 +2981,8 @@ ir.c: # 53| mu53_3(int) = Store[x] : &:r53_2, r53_1 # 55| v55_1(void) = NoOp : # 44| v44_4(void) = ReturnVoid : -#-----| Goto -> Block 1 - -# 44| Block 1 -# 44| v44_5(void) = AliasedUse : ~m? -# 44| v44_6(void) = ExitFunction : - -# 44| Block 2 -# 44| v44_7(void) = Unwind : -#-----| Goto -> Block 1 +# 44| v44_5(void) = AliasedUse : ~m? +# 44| v44_6(void) = ExitFunction : # 57| void throw_in_try_with_finally() # 57| Block 0 @@ -3022,23 +2996,16 @@ ir.c: # 62| r62_2(int) = Constant[0] : # 62| v62_3(void) = Call[ExRaiseAccessViolation] : func:r62_1, 0:r62_2 # 62| mu62_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 3 - -# 57| Block 1 -# 57| v57_4(void) = AliasedUse : ~m? -# 57| v57_5(void) = ExitFunction : - -# 57| Block 2 -# 57| v57_6(void) = Unwind : -#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 1 -# 66| Block 3 +# 66| Block 1 # 66| r66_1(int) = Constant[1] : # 66| r66_2(glval) = VariableAddress[x] : # 66| mu66_3(int) = Store[x] : &:r66_2, r66_1 # 68| v68_1(void) = NoOp : -# 57| v57_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 57| v57_4(void) = ReturnVoid : +# 57| v57_5(void) = AliasedUse : ~m? +# 57| v57_6(void) = ExitFunction : # 70| void throw_in_try_with_throw_in_finally() # 70| Block 0 @@ -3049,27 +3016,19 @@ ir.c: # 73| r73_2(int) = Constant[0] : # 73| v73_3(void) = Call[ExRaiseAccessViolation] : func:r73_1, 0:r73_2 # 73| mu73_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 3 +#-----| SEH Exception -> Block 1 -# 70| Block 1 -# 70| v70_4(void) = AliasedUse : ~m? -# 70| v70_5(void) = ExitFunction : - -# 70| Block 2 -# 70| v70_6(void) = Unwind : -#-----| Goto -> Block 1 - -# 76| Block 3 +# 76| Block 1 # 76| r76_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 76| r76_2(int) = Constant[0] : # 76| v76_3(void) = Call[ExRaiseAccessViolation] : func:r76_1, 0:r76_2 # 76| mu76_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 2 -# 78| Block 4 -# 78| v78_1(void) = NoOp : -# 70| v70_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 78| Block 2 +# 78| v78_1(void) = NoOp : +# 70| v70_4(void) = ReturnVoid : +# 70| v70_5(void) = AliasedUse : ~m? +# 70| v70_6(void) = ExitFunction : # 80| void raise_access_violation() # 80| Block 0 @@ -3080,20 +3039,12 @@ ir.c: # 81| r81_2(int) = Constant[1] : # 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2 # 81| mu81_4(unknown) = ^CallSideEffect : ~m? -#-----| C++ Exception -> Block 2 - -# 80| Block 1 -# 80| v80_4(void) = AliasedUse : ~m? -# 80| v80_5(void) = ExitFunction : -# 80| Block 2 -# 80| v80_6(void) = Unwind : -#-----| Goto -> Block 1 - -# 82| Block 3 -# 82| v82_1(void) = NoOp : -# 80| v80_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 82| Block 1 +# 82| v82_1(void) = NoOp : +# 80| v80_4(void) = ReturnVoid : +# 80| v80_5(void) = AliasedUse : ~m? +# 80| v80_6(void) = ExitFunction : # 84| void branch_on_integral_in_c(int, int) # 84| Block 0 @@ -36973,18 +36924,22 @@ struct_init.cpp: try_except.c: # 6| void f() # 6| Block 0 -# 6| v6_1(void) = EnterFunction : -# 6| mu6_2(unknown) = AliasedDefinition : -# 6| mu6_3(unknown) = InitializeNonLocal : -# 7| r7_1(glval) = VariableAddress[x] : -# 7| mu7_2(int) = Uninitialized[x] : &:r7_1 -# 7| r7_3(glval) = VariableAddress[y] : -# 7| r7_4(int) = Constant[0] : -# 7| mu7_5(int) = Store[y] : &:r7_3, r7_4 -# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : -# 9| r9_2(int) = Constant[0] : -# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 -# 9| mu9_4(unknown) = ^CallSideEffect : ~m? +# 6| v6_1(void) = EnterFunction : +# 6| mu6_2(unknown) = AliasedDefinition : +# 6| mu6_3(unknown) = InitializeNonLocal : +# 7| r7_1(glval) = VariableAddress[x] : +# 7| mu7_2(int) = Uninitialized[x] : &:r7_1 +# 7| r7_3(glval) = VariableAddress[y] : +# 7| r7_4(int) = Constant[0] : +# 7| mu7_5(int) = Store[y] : &:r7_3, r7_4 +# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : +# 9| r9_2(int) = Constant[0] : +# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 +# 9| mu9_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 4 + +# 10| Block 1 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, ~m? # 10| r10_3(glval) = VariableAddress[x] : @@ -36993,49 +36948,41 @@ try_except.c: # 11| r11_2(int) = Constant[0] : # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| mu11_4(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 7 - -# 6| Block 1 -# 6| v6_4(void) = AliasedUse : ~m? -# 6| v6_5(void) = ExitFunction : - -# 6| Block 2 -# 6| v6_6(void) = Unwind : -#-----| Goto -> Block 1 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 13| Block 3 +# 13| Block 2 # 13| r13_1(int) = Constant[0] : # 13| r13_2(bool) = CompareEQ : r13_7, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 4 -#-----| True -> Block 2 +#-----| False -> Block 3 -# 13| Block 4 +# 13| Block 3 # 13| r13_4(int) = Constant[1] : # 13| r13_5(bool) = CompareEQ : r13_7, r13_4 # 13| v13_6(void) = ConditionalBranch : r13_5 -#-----| True -> Block 6 +#-----| True -> Block 5 -# 13| Block 5 +# 13| Block 4 # 13| r13_7(int) = Constant[0] : # 13| r13_8(int) = Constant[-1] : # 13| r13_9(bool) = CompareEQ : r13_7, r13_8 # 13| v13_10(void) = ConditionalBranch : r13_9 -#-----| False -> Block 3 -#-----| True -> Block 2 +#-----| False -> Block 2 -# 14| Block 6 +# 14| Block 5 # 14| r14_1(glval) = FunctionAddress[sink] : # 14| r14_2(glval) = VariableAddress[x] : # 14| r14_3(int) = Load[x] : &:r14_2, ~m? # 14| v14_4(void) = Call[sink] : func:r14_1, 0:r14_3 # 14| mu14_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 7 +#-----| Goto -> Block 6 -# 16| Block 7 -# 16| v16_1(void) = NoOp : -# 6| v6_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 16| Block 6 +# 16| v16_1(void) = NoOp : +# 6| v6_4(void) = ReturnVoid : +# 6| v6_5(void) = AliasedUse : ~m? +# 6| v6_6(void) = ExitFunction : # 18| void g() # 18| Block 0 @@ -37051,6 +36998,10 @@ try_except.c: # 21| r21_2(int) = Constant[0] : # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| mu21_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 22| Block 1 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, ~m? # 22| r22_3(glval) = VariableAddress[x] : @@ -37059,22 +37010,18 @@ try_except.c: # 23| r23_2(int) = Constant[0] : # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| mu23_4(unknown) = ^CallSideEffect : ~m? -# 26| r26_1(glval) = FunctionAddress[sink] : -# 26| r26_2(glval) = VariableAddress[x] : -# 26| r26_3(int) = Load[x] : &:r26_2, ~m? -# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 -# 26| mu26_5(unknown) = ^CallSideEffect : ~m? -# 28| v28_1(void) = NoOp : -# 18| v18_4(void) = ReturnVoid : -#-----| Goto -> Block 1 - -# 18| Block 1 -# 18| v18_5(void) = AliasedUse : ~m? -# 18| v18_6(void) = ExitFunction : - -# 18| Block 2 -# 18| v18_7(void) = Unwind : -#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 26| Block 2 +# 26| r26_1(glval) = FunctionAddress[sink] : +# 26| r26_2(glval) = VariableAddress[x] : +# 26| r26_3(int) = Load[x] : &:r26_2, ~m? +# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 +# 26| mu26_5(unknown) = ^CallSideEffect : ~m? +# 28| v28_1(void) = NoOp : +# 18| v18_4(void) = ReturnVoid : +# 18| v18_5(void) = AliasedUse : ~m? +# 18| v18_6(void) = ExitFunction : # 32| void h(int) # 32| Block 0 @@ -37089,72 +37036,68 @@ try_except.c: # 35| r35_1(glval) = VariableAddress[b] : # 35| r35_2(int) = Load[b] : &:r35_1, ~m? # 35| v35_3(void) = ConditionalBranch : r35_2 -#-----| False -> Block 8 -#-----| True -> Block 3 - -# 32| Block 1 -# 32| v32_6(void) = AliasedUse : ~m? -# 32| v32_7(void) = ExitFunction : - -# 32| Block 2 -# 32| v32_8(void) = Unwind : -#-----| Goto -> Block 1 +#-----| False -> Block 6 +#-----| True -> Block 1 -# 36| Block 3 +# 36| Block 1 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| mu36_3(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 8 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 39| Block 4 +# 39| Block 2 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 5 -#-----| True -> Block 2 +#-----| False -> Block 3 -# 39| Block 5 +# 39| Block 3 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 7 +#-----| True -> Block 5 -# 39| Block 6 +# 39| Block 4 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 4 -#-----| True -> Block 2 +#-----| False -> Block 2 -# 40| Block 7 +# 40| Block 5 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, ~m? # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| mu40_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 8 +#-----| Goto -> Block 6 -# 42| Block 8 -# 42| v42_1(void) = NoOp : -# 32| v32_9(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 42| Block 6 +# 42| v42_1(void) = NoOp : +# 32| v32_6(void) = ReturnVoid : +# 32| v32_7(void) = AliasedUse : ~m? +# 32| v32_8(void) = ExitFunction : try_except.cpp: # 6| void f_cpp() # 6| Block 0 -# 6| v6_1(void) = EnterFunction : -# 6| mu6_2(unknown) = AliasedDefinition : -# 6| mu6_3(unknown) = InitializeNonLocal : -# 7| r7_1(glval) = VariableAddress[x] : -# 7| mu7_2(int) = Uninitialized[x] : &:r7_1 -# 7| r7_3(glval) = VariableAddress[y] : -# 7| r7_4(int) = Constant[0] : -# 7| mu7_5(int) = Store[y] : &:r7_3, r7_4 -# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : -# 9| r9_2(int) = Constant[0] : -# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 -# 9| mu9_4(unknown) = ^CallSideEffect : ~m? +# 6| v6_1(void) = EnterFunction : +# 6| mu6_2(unknown) = AliasedDefinition : +# 6| mu6_3(unknown) = InitializeNonLocal : +# 7| r7_1(glval) = VariableAddress[x] : +# 7| mu7_2(int) = Uninitialized[x] : &:r7_1 +# 7| r7_3(glval) = VariableAddress[y] : +# 7| r7_4(int) = Constant[0] : +# 7| mu7_5(int) = Store[y] : &:r7_3, r7_4 +# 9| r9_1(glval) = FunctionAddress[ProbeFunction] : +# 9| r9_2(int) = Constant[0] : +# 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 +# 9| mu9_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 4 + +# 10| Block 1 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, ~m? # 10| r10_3(glval) = VariableAddress[x] : @@ -37163,49 +37106,41 @@ try_except.cpp: # 11| r11_2(int) = Constant[0] : # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| mu11_4(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 7 - -# 6| Block 1 -# 6| v6_4(void) = AliasedUse : ~m? -# 6| v6_5(void) = ExitFunction : - -# 6| Block 2 -# 6| v6_6(void) = Unwind : -#-----| Goto -> Block 1 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 13| Block 3 +# 13| Block 2 # 13| r13_1(int) = Constant[0] : # 13| r13_2(bool) = CompareEQ : r13_7, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 4 -#-----| True -> Block 2 +#-----| False -> Block 3 -# 13| Block 4 +# 13| Block 3 # 13| r13_4(int) = Constant[1] : # 13| r13_5(bool) = CompareEQ : r13_7, r13_4 # 13| v13_6(void) = ConditionalBranch : r13_5 -#-----| True -> Block 6 +#-----| True -> Block 5 -# 13| Block 5 +# 13| Block 4 # 13| r13_7(int) = Constant[0] : # 13| r13_8(int) = Constant[-1] : # 13| r13_9(bool) = CompareEQ : r13_7, r13_8 # 13| v13_10(void) = ConditionalBranch : r13_9 -#-----| False -> Block 3 -#-----| True -> Block 2 +#-----| False -> Block 2 -# 14| Block 6 +# 14| Block 5 # 14| r14_1(glval) = FunctionAddress[sink] : # 14| r14_2(glval) = VariableAddress[x] : # 14| r14_3(int) = Load[x] : &:r14_2, ~m? # 14| v14_4(void) = Call[sink] : func:r14_1, 0:r14_3 # 14| mu14_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 7 +#-----| Goto -> Block 6 -# 16| Block 7 -# 16| v16_1(void) = NoOp : -# 6| v6_7(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 16| Block 6 +# 16| v16_1(void) = NoOp : +# 6| v6_4(void) = ReturnVoid : +# 6| v6_5(void) = AliasedUse : ~m? +# 6| v6_6(void) = ExitFunction : # 18| void g_cpp() # 18| Block 0 @@ -37221,6 +37156,10 @@ try_except.cpp: # 21| r21_2(int) = Constant[0] : # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| mu21_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 22| Block 1 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, ~m? # 22| r22_3(glval) = VariableAddress[x] : @@ -37229,22 +37168,18 @@ try_except.cpp: # 23| r23_2(int) = Constant[0] : # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| mu23_4(unknown) = ^CallSideEffect : ~m? -# 26| r26_1(glval) = FunctionAddress[sink] : -# 26| r26_2(glval) = VariableAddress[x] : -# 26| r26_3(int) = Load[x] : &:r26_2, ~m? -# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 -# 26| mu26_5(unknown) = ^CallSideEffect : ~m? -# 28| v28_1(void) = NoOp : -# 18| v18_4(void) = ReturnVoid : -#-----| Goto -> Block 1 - -# 18| Block 1 -# 18| v18_5(void) = AliasedUse : ~m? -# 18| v18_6(void) = ExitFunction : - -# 18| Block 2 -# 18| v18_7(void) = Unwind : -#-----| Goto -> Block 1 +#-----| SEH Exception -> Block 2 + +# 26| Block 2 +# 26| r26_1(glval) = FunctionAddress[sink] : +# 26| r26_2(glval) = VariableAddress[x] : +# 26| r26_3(int) = Load[x] : &:r26_2, ~m? +# 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 +# 26| mu26_5(unknown) = ^CallSideEffect : ~m? +# 28| v28_1(void) = NoOp : +# 18| v18_4(void) = ReturnVoid : +# 18| v18_5(void) = AliasedUse : ~m? +# 18| v18_6(void) = ExitFunction : # 32| void h_cpp(int) # 32| Block 0 @@ -37261,56 +37196,48 @@ try_except.cpp: # 35| r35_3(int) = Constant[0] : # 35| r35_4(bool) = CompareNE : r35_2, r35_3 # 35| v35_5(void) = ConditionalBranch : r35_4 -#-----| False -> Block 8 -#-----| True -> Block 3 - -# 32| Block 1 -# 32| v32_6(void) = AliasedUse : ~m? -# 32| v32_7(void) = ExitFunction : - -# 32| Block 2 -# 32| v32_8(void) = Unwind : -#-----| Goto -> Block 1 +#-----| False -> Block 6 +#-----| True -> Block 1 -# 36| Block 3 +# 36| Block 1 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| mu36_3(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 8 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 4 -# 39| Block 4 +# 39| Block 2 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 5 -#-----| True -> Block 2 +#-----| False -> Block 3 -# 39| Block 5 +# 39| Block 3 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 7 +#-----| True -> Block 5 -# 39| Block 6 +# 39| Block 4 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 4 -#-----| True -> Block 2 +#-----| False -> Block 2 -# 40| Block 7 +# 40| Block 5 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, ~m? # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| mu40_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 8 +#-----| Goto -> Block 6 -# 42| Block 8 -# 42| v42_1(void) = NoOp : -# 32| v32_9(void) = ReturnVoid : -#-----| Goto -> Block 1 +# 42| Block 6 +# 42| v42_1(void) = NoOp : +# 32| v32_6(void) = ReturnVoid : +# 32| v32_7(void) = AliasedUse : ~m? +# 32| v32_8(void) = ExitFunction : # 44| void throw_cpp(int) # 44| Block 0 @@ -37343,14 +37270,12 @@ try_except.cpp: # 48| r48_2(int) = Constant[1] : # 48| mu48_3(int) = Store[#throw48:13] : &:r48_1, r48_2 # 48| v48_4(void) = ThrowValue : &:r48_1, ~m? -#-----| C++ Exception -> Block 6 # 51| Block 4 # 51| r51_1(int) = Constant[0] : # 51| r51_2(bool) = CompareEQ : r51_7, r51_1 # 51| v51_3(void) = ConditionalBranch : r51_2 #-----| False -> Block 5 -#-----| True -> Block 2 # 51| Block 5 # 51| r51_4(int) = Constant[1] : @@ -37364,7 +37289,6 @@ try_except.cpp: # 51| r51_9(bool) = CompareEQ : r51_7, r51_8 # 51| v51_10(void) = ConditionalBranch : r51_9 #-----| False -> Block 4 -#-----| True -> Block 2 # 52| Block 7 # 52| r52_1(glval) = FunctionAddress[sink] : diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 7f10f2f9d7c9..49c6be080580 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,6 +6,10 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | +| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | +| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | +| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 7f10f2f9d7c9..49c6be080580 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,6 +6,10 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | +| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | +| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | +| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction From 8c8ed07831ab23576fc094ffa044cdb698a59711 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 12:07:41 -0500 Subject: [PATCH 3/9] Adding comment on invalid throw in test case. --- cpp/ql/test/library-tests/ir/ir/try_except.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/ql/test/library-tests/ir/ir/try_except.cpp b/cpp/ql/test/library-tests/ir/ir/try_except.cpp index 9bf297263b75..0874b557bd93 100644 --- a/cpp/ql/test/library-tests/ir/ir/try_except.cpp +++ b/cpp/ql/test/library-tests/ir/ir/try_except.cpp @@ -45,7 +45,7 @@ void throw_cpp(int b) { int x = 0; __try { if (b) { - throw 1; + throw 1; // invalid use of throw in Seh exception } } __except (1) { From 4a8f0aa6d2c10840dc1812d201d6e3348cdd03c5 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 13:05:32 -0500 Subject: [PATCH 4/9] Updating tests and expected files for syntax-zoo results. --- .../aliased_ssa_consistency.expected | 71 +++++++++++++++++++ .../library-tests/syntax-zoo/ms_try_mix.cpp | 6 +- .../syntax-zoo/raw_consistency.expected | 63 ++++++++++++++++ .../unaliased_ssa_consistency.expected | 54 ++++++++++++++ 4 files changed, 191 insertions(+), 3 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 66f9c9c375f5..7cd5d3a2a7c8 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 @@ -7,9 +7,75 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| 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) | ambiguousSuccessors unexplainedLoop +| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:15:22:39 | Phi: 1 | Instruction 'Phi: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | Chi: definition of c104 | Instruction 'Chi: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | Chi: c104 | Instruction 'Chi: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Chi: c101 | Instruction 'Chi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Phi: c101 | Instruction 'Phi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | Chi: definition of c108 | Instruction 'Chi: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | Phi: definition of c108 | Instruction 'Phi: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | Chi: c108 | Instruction 'Chi: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | Chi: c101 | Instruction 'Chi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -20,6 +86,11 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition switchInstructionWithoutDefaultEdge diff --git a/cpp/ql/test/library-tests/syntax-zoo/ms_try_mix.cpp b/cpp/ql/test/library-tests/syntax-zoo/ms_try_mix.cpp index 28fa24d4c920..b7de011dc141 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/ms_try_mix.cpp +++ b/cpp/ql/test/library-tests/syntax-zoo/ms_try_mix.cpp @@ -15,7 +15,7 @@ void ms_except_mix(int b1) { __try { C c102(102); if (b1) { - throw 1; + throw 1; // invalid use of throw in Seh exception } C c103(103); } @@ -32,7 +32,7 @@ void ms_finally_mix(int b2) { __try { C c106(106); if (b2) { - throw 2; + throw 2; // invalid use of throw in Seh exception } C c107(107); } @@ -50,7 +50,7 @@ void ms_empty_finally_at_end() { C c201(201); __try { - throw 3; + throw 3; // invalid use of throw in Seh exception } __finally { } 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 dc6671af8a40..1f18b6d8143e 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected @@ -8,11 +8,67 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| 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() | ambiguousSuccessors unexplainedLoop +| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:55:13:56:3 | NoOp: { ... } | Instruction 'NoOp: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | IndirectMayWriteSideEffect: c201 | Instruction 'IndirectMayWriteSideEffect: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | IndirectReadSideEffect: c201 | Instruction 'IndirectReadSideEffect: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | +| ms_try_mix.cpp:57:1:57:1 | VariableAddress: c201 | Instruction 'VariableAddress: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -23,6 +79,13 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability +| ms_try_mix.cpp:12:6:12:18 | AliasedUse: ms_except_mix | Block 'AliasedUse: ms_except_mix' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:29:6:29:19 | AliasedUse: ms_finally_mix | Block 'AliasedUse: ms_finally_mix' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition | ms_try_except.cpp:9:19:9:19 | 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) | 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 66f9c9c375f5..9ea923a53952 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 @@ -7,9 +7,58 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| 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) | ambiguousSuccessors unexplainedLoop +| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | +| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -20,6 +69,11 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition switchInstructionWithoutDefaultEdge From f75f69f0a2c453ab530b7684ced389a098606037 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 15:18:40 -0500 Subject: [PATCH 5/9] Altering unwind SEH mechanics, such that SEH unwind is generated if an SEH exception could be raised inside a microsoft try except statement, or if a function may always throw an exception. --- .../raw/internal/TranslatedCall.qll | 11 +++++++++-- .../raw/internal/TranslatedFunction.qll | 17 +++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll index a39d7c6450d0..186bc2c9557d 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll @@ -364,9 +364,16 @@ abstract class TranslatedCallExpr extends TranslatedNonConstantExpr, TranslatedC override predicate mayThrowException(ExceptionEdge e) { // by default, all functions may throw exceptions of any kind // unless explicitly annotated to never throw + // Only consider a call to "may" throw an Seh exception + // if inside a MicrosoftTryStmt not this.neverThrowException(e) and - // for now assuming all calls may throw for Seh only - e instanceof SehExceptionEdge + ( + this.mustThrowException(e) + or + // for now assuming all calls may throw for Seh only + e instanceof SehExceptionEdge and + exists(MicrosoftTryStmt trystmt | trystmt.getAChild*() = expr) + ) } override predicate neverThrowException(ExceptionEdge e) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll index 1002317612ef..67b2e0e741c5 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll @@ -11,6 +11,7 @@ private import TranslatedExpr private import TranslatedInitialization private import TranslatedStmt private import VarArgs +private import EdgeKind /** * Gets the `TranslatedFunction` that represents function `func`. @@ -209,14 +210,16 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { ( // Only generate the `Unwind` instruction if there is any exception // handling present in the function. - // Do not unwind for MicrosoftTryStmt (SEH), as an optimization (SEH exception - // will occur at any store/load, so unwind would appear everywhere as a result) - exists(TryStmt try | try.getEnclosingFunction() = func) + exists(TryOrMicrosoftTryStmt try | try.getEnclosingFunction() = func) or exists(ThrowExpr throw | throw.getEnclosingFunction() = func) or - exists(FunctionCall call, CppExceptionEdge exception | call.getEnclosingFunction() = func | - getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException(exception) + // or + // exists(FunctionCall call | call.getEnclosingFunction() = func | + // getTranslatedExpr(call).(TranslatedCallExpr).mustThrowException(_) + // ) + exists(FunctionCall call | call.getEnclosingFunction() = func | + getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException(_) ) ) or @@ -231,9 +234,7 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { } final override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { - // only unwind for C++ exceptions since SEH exceptions are too verbose - // and would generate unwind for all functions. - exception instanceof CppExceptionEdge and + (exception = cppExceptionEdge() or exception = sehExceptionEdge()) and result = this.getInstruction(UnwindTag()) and kind instanceof GotoEdge } From b1bfe2ed1c35ad98dba135776e91c97e33507e70 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Mon, 9 Dec 2024 15:19:27 -0500 Subject: [PATCH 6/9] Updating test cases for new unwinding mechanic. --- .../library-tests/ir/ir/aliased_ir.expected | 328 +++++++++------ .../ir/ir/aliased_ssa_consistency.expected | 3 - .../aliased_ssa_consistency_unsound.expected | 3 - .../ir/ir/raw_consistency.expected | 3 - .../test/library-tests/ir/ir/raw_ir.expected | 380 ++++++++++++------ .../ir/ir/unaliased_ssa_consistency.expected | 3 - ...unaliased_ssa_consistency_unsound.expected | 3 - .../aliased_ssa_consistency.expected | 72 +--- .../syntax-zoo/raw_consistency.expected | 66 +-- .../unaliased_ssa_consistency.expected | 55 +-- 10 files changed, 458 insertions(+), 458 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected index a9e623633674..967e22e412f1 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected @@ -3167,39 +3167,45 @@ ir.c: # 36| v36_3(void) = Call[ExRaiseAccessViolation] : func:r36_1, 0:r36_2 # 36| m36_4(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_5(unknown) = Chi : total:m32_4, partial:m36_4 -#-----| SEH Exception -> Block 3 +#-----| SEH Exception -> Block 4 -# 39| Block 1 +# 32| Block 1 +# 32| v32_5(void) = Unwind : +# 32| v32_6(void) = AliasedUse : ~m40_5 +# 32| v32_7(void) = ExitFunction : + +# 39| Block 2 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r38_1, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 2 -#-----| True -> Block 5 +#-----| False -> Block 3 +#-----| True -> Block 6 -# 39| Block 2 +# 39| Block 3 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r38_1, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| False -> Block 5 -#-----| True -> Block 4 +#-----| False -> Block 6 +#-----| True -> Block 5 -# 38| Block 3 +# 38| Block 4 # 38| r38_1(int) = Constant[1] : # 39| r39_7(int) = Constant[-1] : # 39| r39_8(bool) = CompareEQ : r38_1, r39_7 # 39| v39_9(void) = ConditionalBranch : r39_8 -#-----| False -> Block 1 -#-----| True -> Block 5 +#-----| False -> Block 2 +#-----| True -> Block 6 -# 40| Block 4 +# 40| Block 5 # 40| r40_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 40| r40_2(int) = Constant[1] : # 40| v40_3(void) = Call[ExRaiseAccessViolation] : func:r40_1, 0:r40_2 # 40| m40_4(unknown) = ^CallSideEffect : ~m36_5 # 40| m40_5(unknown) = Chi : total:m36_5, partial:m40_4 +#-----| SEH Exception -> Block 1 -# 32| Block 5 -# 32| v32_5(void) = Unreached : +# 32| Block 6 +# 32| v32_8(void) = Unreached : # 44| void try_with_finally() # 44| Block 0 @@ -3257,14 +3263,20 @@ ir.c: # 73| v73_3(void) = Call[ExRaiseAccessViolation] : func:r73_1, 0:r73_2 # 73| m73_4(unknown) = ^CallSideEffect : ~m70_4 # 73| m73_5(unknown) = Chi : total:m70_4, partial:m73_4 -#-----| SEH Exception -> Block 1 +#-----| SEH Exception -> Block 2 + +# 70| Block 1 +# 70| v70_5(void) = Unwind : +# 70| v70_6(void) = AliasedUse : ~m76_5 +# 70| v70_7(void) = ExitFunction : -# 76| Block 1 +# 76| Block 2 # 76| r76_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 76| r76_2(int) = Constant[0] : # 76| v76_3(void) = Call[ExRaiseAccessViolation] : func:r76_1, 0:r76_2 # 76| m76_4(unknown) = ^CallSideEffect : ~m73_5 # 76| m76_5(unknown) = Chi : total:m73_5, partial:m76_4 +#-----| SEH Exception -> Block 1 # 80| void raise_access_violation() # 80| Block 0 @@ -3277,6 +3289,12 @@ ir.c: # 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2 # 81| m81_4(unknown) = ^CallSideEffect : ~m80_4 # 81| m81_5(unknown) = Chi : total:m80_4, partial:m81_4 +#-----| SEH Exception -> Block 1 + +# 80| Block 1 +# 80| v80_5(void) = Unwind : +# 80| v80_6(void) = AliasedUse : ~m81_5 +# 80| v80_7(void) = ExitFunction : # 84| void branch_on_integral_in_c(int, int) # 84| Block 0 @@ -38727,10 +38745,19 @@ try_except.c: # 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 # 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 # 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 5 + +# 6| Block 1 +# 6| m6_5(unknown) = Phi : from 2:~m13_4, from 6:~m11_5 +# 6| v6_6(void) = AliasedUse : ~m6_5 +# 6| v6_7(void) = ExitFunction : + +# 6| Block 2 +# 6| v6_8(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 3 -# 10| Block 1 +# 10| Block 3 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, m7_5 # 10| r10_3(glval) = VariableAddress[x] : @@ -38740,31 +38767,32 @@ try_except.c: # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| m11_4(unknown) = ^CallSideEffect : ~m9_5 # 11| m11_5(unknown) = Chi : total:m9_5, partial:m11_4 -#-----| Goto -> Block 4 -#-----| SEH Exception -> Block 3 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 5 -# 13| Block 2 +# 13| Block 4 # 13| r13_1(int) = Constant[0] : -# 13| r13_2(bool) = CompareEQ : r13_4, r13_1 +# 13| r13_2(bool) = CompareEQ : r13_5, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 5 +#-----| False -> Block 7 +#-----| True -> Block 2 -# 13| Block 3 -# 13| r13_4(int) = Constant[0] : -# 13| r13_5(int) = Constant[-1] : -# 13| r13_6(bool) = CompareEQ : r13_4, r13_5 -# 13| v13_7(void) = ConditionalBranch : r13_6 -#-----| False -> Block 2 -#-----| True -> Block 5 +# 13| Block 5 +# 13| m13_4(unknown) = Phi : from 0:~m9_5, from 3:~m11_5 +# 13| r13_5(int) = Constant[0] : +# 13| r13_6(int) = Constant[-1] : +# 13| r13_7(bool) = CompareEQ : r13_5, r13_6 +# 13| v13_8(void) = ConditionalBranch : r13_7 +#-----| False -> Block 4 +#-----| True -> Block 7 -# 16| Block 4 -# 16| v16_1(void) = NoOp : -# 6| v6_5(void) = ReturnVoid : -# 6| v6_6(void) = AliasedUse : ~m11_5 -# 6| v6_7(void) = ExitFunction : +# 16| Block 6 +# 16| v16_1(void) = NoOp : +# 6| v6_9(void) = ReturnVoid : +#-----| Goto -> Block 1 -# 6| Block 5 -# 6| v6_8(void) = Unreached : +# 6| Block 7 +# 6| v6_10(void) = Unreached : # 18| void g() # 18| Block 0 @@ -38782,10 +38810,18 @@ try_except.c: # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| m21_4(unknown) = ^CallSideEffect : ~m18_4 # 21| m21_5(unknown) = Chi : total:m18_4, partial:m21_4 +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 4 + +# 18| Block 1 +# 18| v18_5(void) = AliasedUse : ~m26_8 +# 18| v18_6(void) = ExitFunction : + +# 18| Block 2 +# 18| v18_7(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 2 -# 22| Block 1 +# 22| Block 3 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, m19_5 # 22| r22_3(glval) = VariableAddress[x] : @@ -38795,21 +38831,24 @@ try_except.c: # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| m23_4(unknown) = ^CallSideEffect : ~m21_5 # 23| m23_5(unknown) = Chi : total:m21_5, partial:m23_4 -#-----| SEH Exception -> Block 2 +#-----| SEH Exception -> Block 4 -# 26| Block 2 -# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 1:~m23_5 -# 26| m26_2(int) = Phi : from 0:m19_2, from 1:m22_4 +# 26| Block 4 +# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 3:~m23_5 +# 26| m26_2(int) = Phi : from 0:m19_2, from 3:m22_4 # 26| r26_3(glval) = FunctionAddress[sink] : # 26| r26_4(glval) = VariableAddress[x] : # 26| r26_5(int) = Load[x] : &:r26_4, m26_2 # 26| v26_6(void) = Call[sink] : func:r26_3, 0:r26_5 # 26| m26_7(unknown) = ^CallSideEffect : ~m26_1 # 26| m26_8(unknown) = Chi : total:m26_1, partial:m26_7 -# 28| v28_1(void) = NoOp : -# 18| v18_5(void) = ReturnVoid : -# 18| v18_6(void) = AliasedUse : ~m26_8 -# 18| v18_7(void) = ExitFunction : +#-----| Goto -> Block 5 +#-----| SEH Exception -> Block 2 + +# 28| Block 5 +# 28| v28_1(void) = NoOp : +# 18| v18_8(void) = ReturnVoid : +#-----| Goto -> Block 1 # 32| void h(int) # 32| Block 0 @@ -38825,57 +38864,66 @@ try_except.c: # 35| r35_1(glval) = VariableAddress[b] : # 35| r35_2(int) = Load[b] : &:r35_1, m32_6 # 35| v35_3(void) = ConditionalBranch : r35_2 -#-----| False -> Block 6 -#-----| True -> Block 1 +#-----| False -> Block 8 +#-----| True -> Block 3 -# 36| Block 1 +# 32| Block 1 +# 32| m32_7(unknown) = Phi : from 2:~m40_6, from 8:~m42_1 +# 32| v32_8(void) = AliasedUse : ~m32_7 +# 32| v32_9(void) = ExitFunction : + +# 32| Block 2 +# 32| v32_10(void) = Unwind : +#-----| Goto -> Block 1 + +# 36| Block 3 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| m36_3(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_4(unknown) = Chi : total:m32_4, partial:m36_3 -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 39| Block 2 +# 39| Block 4 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 3 -#-----| True -> Block 7 +#-----| False -> Block 5 +#-----| True -> Block 9 -# 39| Block 3 +# 39| Block 5 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| False -> Block 7 -#-----| True -> Block 5 +#-----| False -> Block 9 +#-----| True -> Block 7 -# 39| Block 4 +# 39| Block 6 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 2 -#-----| True -> Block 7 +#-----| False -> Block 4 +#-----| True -> Block 9 -# 40| Block 5 +# 40| Block 7 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, m33_3 # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| m40_5(unknown) = ^CallSideEffect : ~m36_4 # 40| m40_6(unknown) = Chi : total:m36_4, partial:m40_5 -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 42| Block 6 -# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4, from 5:~m40_6 -# 42| v42_2(void) = NoOp : -# 32| v32_7(void) = ReturnVoid : -# 32| v32_8(void) = AliasedUse : ~m42_1 -# 32| v32_9(void) = ExitFunction : +# 42| Block 8 +# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 3:~m36_4, from 7:~m40_6 +# 42| v42_2(void) = NoOp : +# 32| v32_11(void) = ReturnVoid : +#-----| Goto -> Block 1 -# 32| Block 7 -# 32| v32_10(void) = Unreached : +# 32| Block 9 +# 32| v32_12(void) = Unreached : try_except.cpp: # 6| void f_cpp() @@ -38894,10 +38942,19 @@ try_except.cpp: # 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 # 9| m9_4(unknown) = ^CallSideEffect : ~m6_4 # 9| m9_5(unknown) = Chi : total:m6_4, partial:m9_4 +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 5 + +# 6| Block 1 +# 6| m6_5(unknown) = Phi : from 2:~m13_4, from 6:~m11_5 +# 6| v6_6(void) = AliasedUse : ~m6_5 +# 6| v6_7(void) = ExitFunction : + +# 6| Block 2 +# 6| v6_8(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 3 -# 10| Block 1 +# 10| Block 3 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, m7_5 # 10| r10_3(glval) = VariableAddress[x] : @@ -38907,31 +38964,32 @@ try_except.cpp: # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| m11_4(unknown) = ^CallSideEffect : ~m9_5 # 11| m11_5(unknown) = Chi : total:m9_5, partial:m11_4 -#-----| Goto -> Block 4 -#-----| SEH Exception -> Block 3 +#-----| Goto -> Block 6 +#-----| SEH Exception -> Block 5 -# 13| Block 2 +# 13| Block 4 # 13| r13_1(int) = Constant[0] : -# 13| r13_2(bool) = CompareEQ : r13_4, r13_1 +# 13| r13_2(bool) = CompareEQ : r13_5, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 5 +#-----| False -> Block 7 +#-----| True -> Block 2 -# 13| Block 3 -# 13| r13_4(int) = Constant[0] : -# 13| r13_5(int) = Constant[-1] : -# 13| r13_6(bool) = CompareEQ : r13_4, r13_5 -# 13| v13_7(void) = ConditionalBranch : r13_6 -#-----| False -> Block 2 -#-----| True -> Block 5 +# 13| Block 5 +# 13| m13_4(unknown) = Phi : from 0:~m9_5, from 3:~m11_5 +# 13| r13_5(int) = Constant[0] : +# 13| r13_6(int) = Constant[-1] : +# 13| r13_7(bool) = CompareEQ : r13_5, r13_6 +# 13| v13_8(void) = ConditionalBranch : r13_7 +#-----| False -> Block 4 +#-----| True -> Block 7 -# 16| Block 4 -# 16| v16_1(void) = NoOp : -# 6| v6_5(void) = ReturnVoid : -# 6| v6_6(void) = AliasedUse : ~m11_5 -# 6| v6_7(void) = ExitFunction : +# 16| Block 6 +# 16| v16_1(void) = NoOp : +# 6| v6_9(void) = ReturnVoid : +#-----| Goto -> Block 1 -# 6| Block 5 -# 6| v6_8(void) = Unreached : +# 6| Block 7 +# 6| v6_10(void) = Unreached : # 18| void g_cpp() # 18| Block 0 @@ -38949,10 +39007,18 @@ try_except.cpp: # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| m21_4(unknown) = ^CallSideEffect : ~m18_4 # 21| m21_5(unknown) = Chi : total:m18_4, partial:m21_4 +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 4 + +# 18| Block 1 +# 18| v18_5(void) = AliasedUse : ~m26_8 +# 18| v18_6(void) = ExitFunction : + +# 18| Block 2 +# 18| v18_7(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 2 -# 22| Block 1 +# 22| Block 3 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, m19_5 # 22| r22_3(glval) = VariableAddress[x] : @@ -38962,21 +39028,24 @@ try_except.cpp: # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| m23_4(unknown) = ^CallSideEffect : ~m21_5 # 23| m23_5(unknown) = Chi : total:m21_5, partial:m23_4 -#-----| SEH Exception -> Block 2 +#-----| SEH Exception -> Block 4 -# 26| Block 2 -# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 1:~m23_5 -# 26| m26_2(int) = Phi : from 0:m19_2, from 1:m22_4 +# 26| Block 4 +# 26| m26_1(unknown) = Phi : from 0:~m21_5, from 3:~m23_5 +# 26| m26_2(int) = Phi : from 0:m19_2, from 3:m22_4 # 26| r26_3(glval) = FunctionAddress[sink] : # 26| r26_4(glval) = VariableAddress[x] : # 26| r26_5(int) = Load[x] : &:r26_4, m26_2 # 26| v26_6(void) = Call[sink] : func:r26_3, 0:r26_5 # 26| m26_7(unknown) = ^CallSideEffect : ~m26_1 # 26| m26_8(unknown) = Chi : total:m26_1, partial:m26_7 -# 28| v28_1(void) = NoOp : -# 18| v18_5(void) = ReturnVoid : -# 18| v18_6(void) = AliasedUse : ~m26_8 -# 18| v18_7(void) = ExitFunction : +#-----| Goto -> Block 5 +#-----| SEH Exception -> Block 2 + +# 28| Block 5 +# 28| v28_1(void) = NoOp : +# 18| v18_8(void) = ReturnVoid : +#-----| Goto -> Block 1 # 32| void h_cpp(int) # 32| Block 0 @@ -38994,57 +39063,66 @@ try_except.cpp: # 35| r35_3(int) = Constant[0] : # 35| r35_4(bool) = CompareNE : r35_2, r35_3 # 35| v35_5(void) = ConditionalBranch : r35_4 -#-----| False -> Block 6 -#-----| True -> Block 1 +#-----| False -> Block 8 +#-----| True -> Block 3 + +# 32| Block 1 +# 32| m32_7(unknown) = Phi : from 2:~m40_6, from 8:~m42_1 +# 32| v32_8(void) = AliasedUse : ~m32_7 +# 32| v32_9(void) = ExitFunction : -# 36| Block 1 +# 32| Block 2 +# 32| v32_10(void) = Unwind : +#-----| Goto -> Block 1 + +# 36| Block 3 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| m36_3(unknown) = ^CallSideEffect : ~m32_4 # 36| m36_4(unknown) = Chi : total:m32_4, partial:m36_3 -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 39| Block 2 +# 39| Block 4 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 3 -#-----| True -> Block 7 +#-----| False -> Block 5 +#-----| True -> Block 9 -# 39| Block 3 +# 39| Block 5 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| False -> Block 7 -#-----| True -> Block 5 +#-----| False -> Block 9 +#-----| True -> Block 7 -# 39| Block 4 +# 39| Block 6 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 2 -#-----| True -> Block 7 +#-----| False -> Block 4 +#-----| True -> Block 9 -# 40| Block 5 +# 40| Block 7 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, m33_3 # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| m40_5(unknown) = ^CallSideEffect : ~m36_4 # 40| m40_6(unknown) = Chi : total:m36_4, partial:m40_5 -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 42| Block 6 -# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 1:~m36_4, from 5:~m40_6 -# 42| v42_2(void) = NoOp : -# 32| v32_7(void) = ReturnVoid : -# 32| v32_8(void) = AliasedUse : ~m42_1 -# 32| v32_9(void) = ExitFunction : +# 42| Block 8 +# 42| m42_1(unknown) = Phi : from 0:~m32_4, from 3:~m36_4, from 7:~m40_6 +# 42| v42_2(void) = NoOp : +# 32| v32_11(void) = ReturnVoid : +#-----| Goto -> Block 1 -# 32| Block 7 -# 32| v32_10(void) = Unreached : +# 32| Block 9 +# 32| v32_12(void) = Unreached : # 44| void throw_cpp(int) # 44| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 4cc867601938..764cfcf879b2 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.c:40:5:40:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | -| ir.c:76:5:76:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | -| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | | try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 4cc867601938..764cfcf879b2 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.c:40:5:40:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | -| ir.c:76:5:76:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | -| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | | try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index d83aeff705b2..7c4ef1f7e7ea 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | -| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | -| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | | try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop 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 da23ac98c56d..cbdce21c7460 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -2884,44 +2884,53 @@ ir.c: # 25| r25_3(int) = Load[x] : &:r25_2, ~m? # 25| v25_4(void) = Call[ExRaiseAccessViolation] : func:r25_1, 0:r25_3 # 25| mu25_5(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 4 +#-----| SEH Exception -> Block 6 # 21| Block 1 -# 21| r21_6(glval) = VariableAddress[#return] : -# 21| v21_7(void) = ReturnValue : &:r21_6, ~m? -# 21| v21_8(void) = AliasedUse : ~m? -# 21| v21_9(void) = ExitFunction : +# 21| v21_6(void) = AliasedUse : ~m? +# 21| v21_7(void) = ExitFunction : + +# 21| Block 2 +# 21| r21_8(glval) = VariableAddress[#return] : +# 21| v21_9(void) = ReturnValue : &:r21_8, ~m? +#-----| Goto -> Block 1 -# 26| Block 2 +# 21| Block 3 +# 21| v21_10(void) = Unwind : +#-----| Goto -> Block 1 + +# 26| Block 4 # 26| r26_1(int) = Constant[0] : # 26| r26_2(bool) = CompareEQ : r26_7, r26_1 # 26| v26_3(void) = ConditionalBranch : r26_2 -#-----| False -> Block 3 +#-----| False -> Block 5 +#-----| True -> Block 3 -# 26| Block 3 +# 26| Block 5 # 26| r26_4(int) = Constant[1] : # 26| r26_5(bool) = CompareEQ : r26_7, r26_4 # 26| v26_6(void) = ConditionalBranch : r26_5 -#-----| True -> Block 5 +#-----| True -> Block 7 -# 26| Block 4 +# 26| Block 6 # 26| r26_7(int) = Constant[1] : # 26| r26_8(int) = Constant[-1] : # 26| r26_9(bool) = CompareEQ : r26_7, r26_8 # 26| v26_10(void) = ConditionalBranch : r26_9 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 3 -# 27| Block 5 +# 27| Block 7 # 27| r27_1(glval) = VariableAddress[#return] : # 27| r27_2(int) = Constant[1] : # 27| mu27_3(int) = Store[#return] : &:r27_1, r27_2 -#-----| Goto -> Block 1 +#-----| Goto -> Block 2 -# 29| Block 6 +# 29| Block 8 # 29| r29_1(glval) = VariableAddress[#return] : # 29| r29_2(int) = Constant[0] : # 29| mu29_3(int) = Store[#return] : &:r29_1, r29_2 -#-----| Goto -> Block 1 +#-----| Goto -> Block 2 # 32| void unexplained_loop_regression() # 32| Block 0 @@ -2932,38 +2941,48 @@ ir.c: # 36| r36_2(int) = Constant[0] : # 36| v36_3(void) = Call[ExRaiseAccessViolation] : func:r36_1, 0:r36_2 # 36| mu36_4(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 3 +#-----| SEH Exception -> Block 5 -# 39| Block 1 +# 32| Block 1 +# 32| v32_4(void) = AliasedUse : ~m? +# 32| v32_5(void) = ExitFunction : + +# 32| Block 2 +# 32| v32_6(void) = Unwind : +#-----| Goto -> Block 1 + +# 39| Block 3 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r38_1, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 2 -# 39| Block 2 +# 39| Block 4 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r38_1, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 4 +#-----| True -> Block 6 -# 38| Block 3 +# 38| Block 5 # 38| r38_1(int) = Constant[1] : # 39| r39_7(int) = Constant[-1] : # 39| r39_8(bool) = CompareEQ : r38_1, r39_7 # 39| v39_9(void) = ConditionalBranch : r39_8 -#-----| False -> Block 1 +#-----| False -> Block 3 +#-----| True -> Block 2 -# 40| Block 4 +# 40| Block 6 # 40| r40_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 40| r40_2(int) = Constant[1] : # 40| v40_3(void) = Call[ExRaiseAccessViolation] : func:r40_1, 0:r40_2 # 40| mu40_4(unknown) = ^CallSideEffect : ~m? +#-----| SEH Exception -> Block 2 -# 42| Block 5 -# 42| v42_1(void) = NoOp : -# 32| v32_4(void) = ReturnVoid : -# 32| v32_5(void) = AliasedUse : ~m? -# 32| v32_6(void) = ExitFunction : +# 42| Block 7 +# 42| v42_1(void) = NoOp : +# 32| v32_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 44| void try_with_finally() # 44| Block 0 @@ -2981,8 +3000,15 @@ ir.c: # 53| mu53_3(int) = Store[x] : &:r53_2, r53_1 # 55| v55_1(void) = NoOp : # 44| v44_4(void) = ReturnVoid : -# 44| v44_5(void) = AliasedUse : ~m? -# 44| v44_6(void) = ExitFunction : +#-----| Goto -> Block 1 + +# 44| Block 1 +# 44| v44_5(void) = AliasedUse : ~m? +# 44| v44_6(void) = ExitFunction : + +# 44| Block 2 +# 44| v44_7(void) = Unwind : +#-----| Goto -> Block 1 # 57| void throw_in_try_with_finally() # 57| Block 0 @@ -2996,16 +3022,23 @@ ir.c: # 62| r62_2(int) = Constant[0] : # 62| v62_3(void) = Call[ExRaiseAccessViolation] : func:r62_1, 0:r62_2 # 62| mu62_4(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 1 +#-----| SEH Exception -> Block 3 -# 66| Block 1 +# 57| Block 1 +# 57| v57_4(void) = AliasedUse : ~m? +# 57| v57_5(void) = ExitFunction : + +# 57| Block 2 +# 57| v57_6(void) = Unwind : +#-----| Goto -> Block 1 + +# 66| Block 3 # 66| r66_1(int) = Constant[1] : # 66| r66_2(glval) = VariableAddress[x] : # 66| mu66_3(int) = Store[x] : &:r66_2, r66_1 # 68| v68_1(void) = NoOp : -# 57| v57_4(void) = ReturnVoid : -# 57| v57_5(void) = AliasedUse : ~m? -# 57| v57_6(void) = ExitFunction : +# 57| v57_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 70| void throw_in_try_with_throw_in_finally() # 70| Block 0 @@ -3016,19 +3049,27 @@ ir.c: # 73| r73_2(int) = Constant[0] : # 73| v73_3(void) = Call[ExRaiseAccessViolation] : func:r73_1, 0:r73_2 # 73| mu73_4(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 1 +#-----| SEH Exception -> Block 3 + +# 70| Block 1 +# 70| v70_4(void) = AliasedUse : ~m? +# 70| v70_5(void) = ExitFunction : + +# 70| Block 2 +# 70| v70_6(void) = Unwind : +#-----| Goto -> Block 1 -# 76| Block 1 +# 76| Block 3 # 76| r76_1(glval) = FunctionAddress[ExRaiseAccessViolation] : # 76| r76_2(int) = Constant[0] : # 76| v76_3(void) = Call[ExRaiseAccessViolation] : func:r76_1, 0:r76_2 # 76| mu76_4(unknown) = ^CallSideEffect : ~m? +#-----| SEH Exception -> Block 2 -# 78| Block 2 -# 78| v78_1(void) = NoOp : -# 70| v70_4(void) = ReturnVoid : -# 70| v70_5(void) = AliasedUse : ~m? -# 70| v70_6(void) = ExitFunction : +# 78| Block 4 +# 78| v78_1(void) = NoOp : +# 70| v70_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 80| void raise_access_violation() # 80| Block 0 @@ -3039,12 +3080,20 @@ ir.c: # 81| r81_2(int) = Constant[1] : # 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2 # 81| mu81_4(unknown) = ^CallSideEffect : ~m? +#-----| SEH Exception -> Block 2 -# 82| Block 1 -# 82| v82_1(void) = NoOp : -# 80| v80_4(void) = ReturnVoid : -# 80| v80_5(void) = AliasedUse : ~m? -# 80| v80_6(void) = ExitFunction : +# 80| Block 1 +# 80| v80_4(void) = AliasedUse : ~m? +# 80| v80_5(void) = ExitFunction : + +# 80| Block 2 +# 80| v80_6(void) = Unwind : +#-----| Goto -> Block 1 + +# 82| Block 3 +# 82| v82_1(void) = NoOp : +# 80| v80_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 84| void branch_on_integral_in_c(int, int) # 84| Block 0 @@ -36936,10 +36985,18 @@ try_except.c: # 9| r9_2(int) = Constant[0] : # 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 # 9| mu9_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 6 + +# 6| Block 1 +# 6| v6_4(void) = AliasedUse : ~m? +# 6| v6_5(void) = ExitFunction : + +# 6| Block 2 +# 6| v6_6(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 4 -# 10| Block 1 +# 10| Block 3 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, ~m? # 10| r10_3(glval) = VariableAddress[x] : @@ -36948,41 +37005,43 @@ try_except.c: # 11| r11_2(int) = Constant[0] : # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| mu11_4(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 13| Block 2 +# 13| Block 4 # 13| r13_1(int) = Constant[0] : # 13| r13_2(bool) = CompareEQ : r13_7, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 3 +#-----| False -> Block 5 +#-----| True -> Block 2 -# 13| Block 3 +# 13| Block 5 # 13| r13_4(int) = Constant[1] : # 13| r13_5(bool) = CompareEQ : r13_7, r13_4 # 13| v13_6(void) = ConditionalBranch : r13_5 -#-----| True -> Block 5 +#-----| True -> Block 7 -# 13| Block 4 +# 13| Block 6 # 13| r13_7(int) = Constant[0] : # 13| r13_8(int) = Constant[-1] : # 13| r13_9(bool) = CompareEQ : r13_7, r13_8 # 13| v13_10(void) = ConditionalBranch : r13_9 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 2 -# 14| Block 5 +# 14| Block 7 # 14| r14_1(glval) = FunctionAddress[sink] : # 14| r14_2(glval) = VariableAddress[x] : # 14| r14_3(int) = Load[x] : &:r14_2, ~m? # 14| v14_4(void) = Call[sink] : func:r14_1, 0:r14_3 # 14| mu14_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 16| Block 6 -# 16| v16_1(void) = NoOp : -# 6| v6_4(void) = ReturnVoid : -# 6| v6_5(void) = AliasedUse : ~m? -# 6| v6_6(void) = ExitFunction : +# 16| Block 8 +# 16| v16_1(void) = NoOp : +# 6| v6_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 18| void g() # 18| Block 0 @@ -36998,10 +37057,18 @@ try_except.c: # 21| r21_2(int) = Constant[0] : # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| mu21_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 4 + +# 18| Block 1 +# 18| v18_4(void) = AliasedUse : ~m? +# 18| v18_5(void) = ExitFunction : + +# 18| Block 2 +# 18| v18_6(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 2 -# 22| Block 1 +# 22| Block 3 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, ~m? # 22| r22_3(glval) = VariableAddress[x] : @@ -37010,18 +37077,21 @@ try_except.c: # 23| r23_2(int) = Constant[0] : # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| mu23_4(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 2 +#-----| SEH Exception -> Block 4 -# 26| Block 2 +# 26| Block 4 # 26| r26_1(glval) = FunctionAddress[sink] : # 26| r26_2(glval) = VariableAddress[x] : # 26| r26_3(int) = Load[x] : &:r26_2, ~m? # 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 # 26| mu26_5(unknown) = ^CallSideEffect : ~m? -# 28| v28_1(void) = NoOp : -# 18| v18_4(void) = ReturnVoid : -# 18| v18_5(void) = AliasedUse : ~m? -# 18| v18_6(void) = ExitFunction : +#-----| Goto -> Block 5 +#-----| SEH Exception -> Block 2 + +# 28| Block 5 +# 28| v28_1(void) = NoOp : +# 18| v18_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 32| void h(int) # 32| Block 0 @@ -37036,48 +37106,58 @@ try_except.c: # 35| r35_1(glval) = VariableAddress[b] : # 35| r35_2(int) = Load[b] : &:r35_1, ~m? # 35| v35_3(void) = ConditionalBranch : r35_2 -#-----| False -> Block 6 -#-----| True -> Block 1 +#-----| False -> Block 8 +#-----| True -> Block 3 -# 36| Block 1 +# 32| Block 1 +# 32| v32_6(void) = AliasedUse : ~m? +# 32| v32_7(void) = ExitFunction : + +# 32| Block 2 +# 32| v32_8(void) = Unwind : +#-----| Goto -> Block 1 + +# 36| Block 3 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| mu36_3(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 39| Block 2 +# 39| Block 4 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 3 +#-----| False -> Block 5 +#-----| True -> Block 2 -# 39| Block 3 +# 39| Block 5 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 5 +#-----| True -> Block 7 -# 39| Block 4 +# 39| Block 6 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 2 -# 40| Block 5 +# 40| Block 7 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, ~m? # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| mu40_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 42| Block 6 -# 42| v42_1(void) = NoOp : -# 32| v32_6(void) = ReturnVoid : -# 32| v32_7(void) = AliasedUse : ~m? -# 32| v32_8(void) = ExitFunction : +# 42| Block 8 +# 42| v42_1(void) = NoOp : +# 32| v32_9(void) = ReturnVoid : +#-----| Goto -> Block 1 try_except.cpp: # 6| void f_cpp() @@ -37094,10 +37174,18 @@ try_except.cpp: # 9| r9_2(int) = Constant[0] : # 9| v9_3(void) = Call[ProbeFunction] : func:r9_1, 0:r9_2 # 9| mu9_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 6 + +# 6| Block 1 +# 6| v6_4(void) = AliasedUse : ~m? +# 6| v6_5(void) = ExitFunction : + +# 6| Block 2 +# 6| v6_6(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 4 -# 10| Block 1 +# 10| Block 3 # 10| r10_1(glval) = VariableAddress[y] : # 10| r10_2(int) = Load[y] : &:r10_1, ~m? # 10| r10_3(glval) = VariableAddress[x] : @@ -37106,41 +37194,43 @@ try_except.cpp: # 11| r11_2(int) = Constant[0] : # 11| v11_3(void) = Call[ProbeFunction] : func:r11_1, 0:r11_2 # 11| mu11_4(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 13| Block 2 +# 13| Block 4 # 13| r13_1(int) = Constant[0] : # 13| r13_2(bool) = CompareEQ : r13_7, r13_1 # 13| v13_3(void) = ConditionalBranch : r13_2 -#-----| False -> Block 3 +#-----| False -> Block 5 +#-----| True -> Block 2 -# 13| Block 3 +# 13| Block 5 # 13| r13_4(int) = Constant[1] : # 13| r13_5(bool) = CompareEQ : r13_7, r13_4 # 13| v13_6(void) = ConditionalBranch : r13_5 -#-----| True -> Block 5 +#-----| True -> Block 7 -# 13| Block 4 +# 13| Block 6 # 13| r13_7(int) = Constant[0] : # 13| r13_8(int) = Constant[-1] : # 13| r13_9(bool) = CompareEQ : r13_7, r13_8 # 13| v13_10(void) = ConditionalBranch : r13_9 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 2 -# 14| Block 5 +# 14| Block 7 # 14| r14_1(glval) = FunctionAddress[sink] : # 14| r14_2(glval) = VariableAddress[x] : # 14| r14_3(int) = Load[x] : &:r14_2, ~m? # 14| v14_4(void) = Call[sink] : func:r14_1, 0:r14_3 # 14| mu14_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 16| Block 6 -# 16| v16_1(void) = NoOp : -# 6| v6_4(void) = ReturnVoid : -# 6| v6_5(void) = AliasedUse : ~m? -# 6| v6_6(void) = ExitFunction : +# 16| Block 8 +# 16| v16_1(void) = NoOp : +# 6| v6_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 18| void g_cpp() # 18| Block 0 @@ -37156,10 +37246,18 @@ try_except.cpp: # 21| r21_2(int) = Constant[0] : # 21| v21_3(void) = Call[ProbeFunction] : func:r21_1, 0:r21_2 # 21| mu21_4(unknown) = ^CallSideEffect : ~m? +#-----| Goto -> Block 3 +#-----| SEH Exception -> Block 4 + +# 18| Block 1 +# 18| v18_4(void) = AliasedUse : ~m? +# 18| v18_5(void) = ExitFunction : + +# 18| Block 2 +# 18| v18_6(void) = Unwind : #-----| Goto -> Block 1 -#-----| SEH Exception -> Block 2 -# 22| Block 1 +# 22| Block 3 # 22| r22_1(glval) = VariableAddress[y] : # 22| r22_2(int) = Load[y] : &:r22_1, ~m? # 22| r22_3(glval) = VariableAddress[x] : @@ -37168,18 +37266,21 @@ try_except.cpp: # 23| r23_2(int) = Constant[0] : # 23| v23_3(void) = Call[ProbeFunction] : func:r23_1, 0:r23_2 # 23| mu23_4(unknown) = ^CallSideEffect : ~m? -#-----| SEH Exception -> Block 2 +#-----| SEH Exception -> Block 4 -# 26| Block 2 +# 26| Block 4 # 26| r26_1(glval) = FunctionAddress[sink] : # 26| r26_2(glval) = VariableAddress[x] : # 26| r26_3(int) = Load[x] : &:r26_2, ~m? # 26| v26_4(void) = Call[sink] : func:r26_1, 0:r26_3 # 26| mu26_5(unknown) = ^CallSideEffect : ~m? -# 28| v28_1(void) = NoOp : -# 18| v18_4(void) = ReturnVoid : -# 18| v18_5(void) = AliasedUse : ~m? -# 18| v18_6(void) = ExitFunction : +#-----| Goto -> Block 5 +#-----| SEH Exception -> Block 2 + +# 28| Block 5 +# 28| v28_1(void) = NoOp : +# 18| v18_7(void) = ReturnVoid : +#-----| Goto -> Block 1 # 32| void h_cpp(int) # 32| Block 0 @@ -37196,48 +37297,58 @@ try_except.cpp: # 35| r35_3(int) = Constant[0] : # 35| r35_4(bool) = CompareNE : r35_2, r35_3 # 35| v35_5(void) = ConditionalBranch : r35_4 -#-----| False -> Block 6 -#-----| True -> Block 1 +#-----| False -> Block 8 +#-----| True -> Block 3 + +# 32| Block 1 +# 32| v32_6(void) = AliasedUse : ~m? +# 32| v32_7(void) = ExitFunction : + +# 32| Block 2 +# 32| v32_8(void) = Unwind : +#-----| Goto -> Block 1 -# 36| Block 1 +# 36| Block 3 # 36| r36_1(glval) = FunctionAddress[AfxThrowMemoryException] : # 36| v36_2(void) = Call[AfxThrowMemoryException] : func:r36_1 # 36| mu36_3(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 -#-----| SEH Exception -> Block 4 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 6 -# 39| Block 2 +# 39| Block 4 # 39| r39_1(int) = Constant[0] : # 39| r39_2(bool) = CompareEQ : r39_7, r39_1 # 39| v39_3(void) = ConditionalBranch : r39_2 -#-----| False -> Block 3 +#-----| False -> Block 5 +#-----| True -> Block 2 -# 39| Block 3 +# 39| Block 5 # 39| r39_4(int) = Constant[1] : # 39| r39_5(bool) = CompareEQ : r39_7, r39_4 # 39| v39_6(void) = ConditionalBranch : r39_5 -#-----| True -> Block 5 +#-----| True -> Block 7 -# 39| Block 4 +# 39| Block 6 # 39| r39_7(int) = Constant[1] : # 39| r39_8(int) = Constant[-1] : # 39| r39_9(bool) = CompareEQ : r39_7, r39_8 # 39| v39_10(void) = ConditionalBranch : r39_9 -#-----| False -> Block 2 +#-----| False -> Block 4 +#-----| True -> Block 2 -# 40| Block 5 +# 40| Block 7 # 40| r40_1(glval) = FunctionAddress[sink] : # 40| r40_2(glval) = VariableAddress[x] : # 40| r40_3(int) = Load[x] : &:r40_2, ~m? # 40| v40_4(void) = Call[sink] : func:r40_1, 0:r40_3 # 40| mu40_5(unknown) = ^CallSideEffect : ~m? -#-----| Goto -> Block 6 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 -# 42| Block 6 -# 42| v42_1(void) = NoOp : -# 32| v32_6(void) = ReturnVoid : -# 32| v32_7(void) = AliasedUse : ~m? -# 32| v32_8(void) = ExitFunction : +# 42| Block 8 +# 42| v42_1(void) = NoOp : +# 32| v32_9(void) = ReturnVoid : +#-----| Goto -> Block 1 # 44| void throw_cpp(int) # 44| Block 0 @@ -37276,6 +37387,7 @@ try_except.cpp: # 51| r51_2(bool) = CompareEQ : r51_7, r51_1 # 51| v51_3(void) = ConditionalBranch : r51_2 #-----| False -> Block 5 +#-----| True -> Block 2 # 51| Block 5 # 51| r51_4(int) = Constant[1] : @@ -37289,6 +37401,7 @@ try_except.cpp: # 51| r51_9(bool) = CompareEQ : r51_7, r51_8 # 51| v51_10(void) = ConditionalBranch : r51_9 #-----| False -> Block 4 +#-----| True -> Block 2 # 52| Block 7 # 52| r52_1(glval) = FunctionAddress[sink] : @@ -37297,6 +37410,7 @@ try_except.cpp: # 52| v52_4(void) = Call[sink] : func:r52_1, 0:r52_3 # 52| mu52_5(unknown) = ^CallSideEffect : ~m? #-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 # 54| Block 8 # 54| v54_1(void) = NoOp : diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 49c6be080580..764cfcf879b2 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | -| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | -| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | | try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 49c6be080580..764cfcf879b2 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.c:40:5:40:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() | -| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() | -| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() | | try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop 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 7cd5d3a2a7c8..331edd45b385 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 @@ -7,75 +7,12 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ms_try_mix.cpp:21:5:21:5 | Chi: c102 | Instruction 'Chi: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:38:5:38:5 | Chi: c106 | Instruction 'Chi: c106' 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) | ambiguousSuccessors unexplainedLoop -| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:15:22:39 | Phi: 1 | Instruction 'Phi: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | Chi: definition of c104 | Instruction 'Chi: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | Chi: c104 | Instruction 'Chi: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Chi: c101 | Instruction 'Chi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Phi: c101 | Instruction 'Phi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | Chi: definition of c108 | Instruction 'Chi: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | Phi: definition of c108 | Instruction 'Phi: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | Chi: call to C | Instruction 'Chi: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | Chi: c108 | Instruction 'Chi: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | Chi: c101 | Instruction 'Chi: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | Chi: call to ~C | Instruction 'Chi: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -86,11 +23,6 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition switchInstructionWithoutDefaultEdge 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 1f18b6d8143e..6436aae060cb 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected @@ -8,67 +8,14 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ms_try_mix.cpp:21:5:21:5 | IndirectMayWriteSideEffect: c102 | Instruction 'IndirectMayWriteSideEffect: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:38:5:38:5 | IndirectMayWriteSideEffect: c106 | Instruction 'IndirectMayWriteSideEffect: c106' 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() | ambiguousSuccessors unexplainedLoop -| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:55:13:56:3 | NoOp: { ... } | Instruction 'NoOp: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | IndirectMayWriteSideEffect: c201 | Instruction 'IndirectMayWriteSideEffect: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | IndirectReadSideEffect: c201 | Instruction 'IndirectReadSideEffect: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | -| ms_try_mix.cpp:57:1:57:1 | VariableAddress: c201 | Instruction 'VariableAddress: c201' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -79,19 +26,14 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability -| ms_try_mix.cpp:12:6:12:18 | AliasedUse: ms_except_mix | Block 'AliasedUse: ms_except_mix' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:29:6:29:19 | AliasedUse: ms_finally_mix | Block 'AliasedUse: ms_finally_mix' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition | ms_try_except.cpp:9:19:9:19 | 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) | | ms_try_except.cpp:9:19:9:19 | 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) | | 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) | | 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) | +| ms_try_mix.cpp:22:15:22:39 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:22:15:22:39 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(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) | switchInstructionWithoutDefaultEdge 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 9ea923a53952..adf651b7be73 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 @@ -7,58 +7,12 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| ms_try_mix.cpp:21:5:21:5 | IndirectMayWriteSideEffect: c102 | Instruction 'IndirectMayWriteSideEffect: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | +| ms_try_mix.cpp:38:5:38:5 | IndirectMayWriteSideEffect: c106 | Instruction 'IndirectMayWriteSideEffect: c106' 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) | ambiguousSuccessors unexplainedLoop -| ms_try_mix.cpp:22:15:22:39 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | CompareEQ: { ... } | Instruction 'CompareEQ: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | ConditionalBranch: { ... } | Instruction 'ConditionalBranch: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Instruction 'Constant: { ... }' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | Uninitialized: definition of c104 | Instruction 'Uninitialized: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Instruction 'VariableAddress: definition of c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:18 | Constant: 104 | Instruction 'Constant: 104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:16:23:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectMayWriteSideEffect: c104 | Instruction 'IndirectMayWriteSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | IndirectReadSideEffect: c104 | Instruction 'IndirectReadSideEffect: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:24:5:24:5 | VariableAddress: c104 | Instruction 'VariableAddress: c104' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:27:1:27:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | Uninitialized: definition of c108 | Instruction 'Uninitialized: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:11:40:14 | VariableAddress: definition of c108 | Instruction 'VariableAddress: definition of c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:18 | Constant: 108 | Instruction 'Constant: 108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | Call: call to C | Instruction 'Call: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | CallSideEffect: call to C | Instruction 'CallSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | FunctionAddress: call to C | Instruction 'FunctionAddress: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:40:16:40:19 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectMayWriteSideEffect: c108 | Instruction 'IndirectMayWriteSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | IndirectReadSideEffect: c108 | Instruction 'IndirectReadSideEffect: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:41:5:41:5 | VariableAddress: c108 | Instruction 'VariableAddress: c108' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | Call: call to ~C | Instruction 'Call: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | CallSideEffect: call to ~C | Instruction 'CallSideEffect: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | FunctionAddress: call to ~C | Instruction 'FunctionAddress: call to ~C' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectMayWriteSideEffect: c101 | Instruction 'IndirectMayWriteSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | IndirectReadSideEffect: c101 | Instruction 'IndirectReadSideEffect: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | -| ms_try_mix.cpp:44:1:44:1 | VariableAddress: c101 | Instruction 'VariableAddress: c101' is part of an unexplained loop in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions @@ -69,11 +23,6 @@ containsLoopOfForwardEdges missingIRType multipleIRTypes lostReachability -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:42:24:5 | Constant: { ... } | Block 'Constant: { ... }' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:23:11:23:14 | VariableAddress: definition of c104 | Block 'VariableAddress: definition of c104' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:26:7:26:10 | VariableAddress: definition of c105 | Block 'VariableAddress: definition of c105' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:43:7:43:10 | VariableAddress: definition of c109 | Block 'VariableAddress: definition of c109' is not reachable by traversing only forward edges in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) | backEdgeCountMismatch useNotDominatedByDefinition switchInstructionWithoutDefaultEdge From b2871962da728e78ac939ea5fa0e930cc99faeea Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Tue, 10 Dec 2024 11:03:15 -0500 Subject: [PATCH 7/9] Adding support for throw inside of microsoft try/except to simplify the IR implementation and revert consistency check issues. There is a larger issue of how to address erroneous mix and match with SEH and traditional exceptions. --- .../raw/internal/TranslatedCall.qll | 2 +- .../raw/internal/TranslatedElement.qll | 4 +- .../raw/internal/TranslatedExpr.qll | 11 +++-- .../raw/internal/TranslatedFunction.qll | 8 +--- .../raw/internal/TranslatedStmt.qll | 47 ++++++------------- 5 files changed, 26 insertions(+), 46 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll index 186bc2c9557d..30054e647e21 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll @@ -91,7 +91,7 @@ abstract class TranslatedCall extends TranslatedExpr { exists(ExceptionEdge e | this.hasExceptionBehavior(e) | this.mayThrowException(e) and kind = e and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) ) ) } 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 b279624afea0..8e7e46c94c62 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 @@ -1107,8 +1107,8 @@ abstract class TranslatedElement extends TTranslatedElement { * nearest enclosing `try`, or the `Unwind` instruction for the function if * there is no enclosing `try`. The successor edge kind is specified by `kind`. */ - Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { - result = this.getParent().getExceptionSuccessorInstruction(kind, exception) + Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + result = this.getParent().getExceptionSuccessorInstruction(kind) } /** 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 db46c5dcd124..0c6c24294489 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 @@ -15,9 +15,14 @@ private import TranslatedInitialization private import TranslatedStmt private import TranslatedGlobalVar private import IRConstruction -private import EdgeKind import TranslatedCall +predicate tbd(TranslatedElement e, Instruction i, string s) { + e.getInstruction(_) = i and + not exists(i.getSuccessor(_)) and + s = concat(e.getAQlClass(), ",") +} + /** * Gets the TranslatedExpr for the specified expression. If `expr` is a load or synthesized * temporary object, the result is the TranslatedExpr for the load or synthetic temporary object @@ -3045,7 +3050,7 @@ class TranslatedDestructorsAfterThrow extends TranslatedElement, TTranslatedDest // And otherwise, exit this element with an exceptional edge not exists(this.getChild(id + 1)) and kind instanceof CppExceptionEdge and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) ) } @@ -3084,7 +3089,7 @@ abstract class TranslatedThrowExpr extends TranslatedNonConstantExpr { or not exists(this.getDestructors()) and kind instanceof CppExceptionEdge and - result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge), kind) + result = this.getParent().getExceptionSuccessorInstruction(any(GotoEdge edge)) ) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll index 67b2e0e741c5..83736ae98d04 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll @@ -11,7 +11,6 @@ private import TranslatedExpr private import TranslatedInitialization private import TranslatedStmt private import VarArgs -private import EdgeKind /** * Gets the `TranslatedFunction` that represents function `func`. @@ -214,10 +213,6 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { or exists(ThrowExpr throw | throw.getEnclosingFunction() = func) or - // or - // exists(FunctionCall call | call.getEnclosingFunction() = func | - // getTranslatedExpr(call).(TranslatedCallExpr).mustThrowException(_) - // ) exists(FunctionCall call | call.getEnclosingFunction() = func | getTranslatedExpr(call).(TranslatedCallExpr).mayThrowException(_) ) @@ -233,8 +228,7 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { ) } - final override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { - (exception = cppExceptionEdge() or exception = sehExceptionEdge()) and + final override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { result = this.getInstruction(UnwindTag()) and kind instanceof GotoEdge } 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 c1628dffeb5e..e0c7d625e81c 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 @@ -10,7 +10,6 @@ private import TranslatedElement private import TranslatedExpr private import TranslatedFunction private import TranslatedInitialization -private import EdgeKind TranslatedStmt getTranslatedStmt(Stmt stmt) { result.getAst() = stmt } @@ -152,7 +151,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, // TODO: This is not really correct. The semantics of `EXCEPTION_CONTINUE_EXECUTION` is that // we should continue execution at the point where the exception occurred. But we don't have // any instruction to model this behavior. - result = this.getExceptionSuccessorInstruction(any(GotoEdge edge), sehExceptionEdge()) + result = this.getExceptionSuccessorInstruction(any(GotoEdge edge)) or kind instanceof FalseEdge and result = this.getInstruction(TryExceptGenerateZero()) @@ -172,7 +171,7 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, tag = TryExceptCompareZeroBranch() and ( kind instanceof TrueEdge and - result = this.getExceptionSuccessorInstruction(any(GotoEdge edge), sehExceptionEdge()) + result = this.getExceptionSuccessorInstruction(any(GotoEdge edge)) or kind instanceof FalseEdge and result = this.getInstruction(TryExceptGenerateOne()) @@ -227,10 +226,10 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement, final override Function getFunction() { result = tryExcept.getEnclosingFunction() } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { // A throw from within a `__except` block flows to the handler for the parent of // the `__try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) } } @@ -283,10 +282,10 @@ class TranslatedMicrosoftTryFinallyHandler extends TranslatedElement, result = getTranslatedStmt(tryFinally.getFinally()) } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { // A throw from within a `__finally` block flows to the handler for the parent of // the `__try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) } } @@ -735,32 +734,14 @@ class TranslatedTryStmt extends TranslatedStmt { // of the `try`, because the exception successor of the `try` itself is // the first catch clause. handler = this.getHandler(stmt.getNumberOfCatchClauses() - 1) and - exists(ExceptionEdge exception | - stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge - or - stmt instanceof TryStmt and exception instanceof CppExceptionEdge - | - result = this.getParent().getExceptionSuccessorInstruction(kind, exception) - ) + result = this.getParent().getExceptionSuccessorInstruction(kind) } - final override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { - // Seh exceptions are only handled for Seh try statements and - // C++ exceptions for C++ try statements. - // I.e., we are assuming there isn't a mix and match between Seh and C++ exceptions. - // They are either all Seh or all C++ within a single try block depending on the - // try type (TryStmt vs MicrosoftTryStmt). - ( - stmt instanceof TryStmt and exception instanceof CppExceptionEdge - or - stmt instanceof MicrosoftTryStmt and exception instanceof SehExceptionEdge - ) and - ( - result = this.getHandler(0).getFirstInstruction(kind) - or - not exists(this.getHandler(_)) and - result = this.getFinally().getFirstInstruction(kind) - ) + final override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { + result = this.getHandler(0).getFirstInstruction(kind) + or + not exists(this.getHandler(_)) and + result = this.getFinally().getFirstInstruction(kind) } private TranslatedElement getHandler(int index) { result = stmt.getTranslatedHandler(index) } @@ -840,10 +821,10 @@ abstract class TranslatedHandler extends TranslatedStmt { child = this.getBlock() and result = this.getParent().getChildSuccessor(this, kind) } - override Instruction getExceptionSuccessorInstruction(EdgeKind kind, ExceptionEdge exception) { + override Instruction getExceptionSuccessorInstruction(EdgeKind kind) { // A throw from within a `catch` block flows to the handler for the parent of // the `try`. - result = this.getParent().getParent().getExceptionSuccessorInstruction(kind, exception) + result = this.getParent().getParent().getExceptionSuccessorInstruction(kind) } TranslatedStmt getBlock() { result = getTranslatedStmt(stmt.getBlock()) } From 4818bd659baebd3120c4f643a402f90214879c94 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Tue, 10 Dec 2024 11:08:26 -0500 Subject: [PATCH 8/9] Updating expected files --- .../library-tests/ir/ir/aliased_ir.expected | 62 ++++++++++++++++--- .../ir/ir/aliased_ssa_consistency.expected | 1 - .../aliased_ssa_consistency_unsound.expected | 1 - .../ir/ir/raw_consistency.expected | 3 - .../test/library-tests/ir/ir/raw_ir.expected | 1 + .../ir/ir/unaliased_ssa_consistency.expected | 1 - ...unaliased_ssa_consistency_unsound.expected | 1 - .../aliased_ssa_consistency.expected | 3 - .../syntax-zoo/raw_consistency.expected | 5 -- .../unaliased_ssa_consistency.expected | 3 - 10 files changed, 53 insertions(+), 28 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected index 967e22e412f1..da2136cba1d4 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ir.expected @@ -39140,20 +39140,62 @@ try_except.cpp: # 47| r47_3(int) = Constant[0] : # 47| r47_4(bool) = CompareNE : r47_2, r47_3 # 47| v47_5(void) = ConditionalBranch : r47_4 -#-----| False -> Block 2 -#-----| True -> Block 1 +#-----| False -> Block 8 +#-----| True -> Block 3 + +# 44| Block 1 +# 44| m44_7(unknown) = Phi : from 2:~m52_6, from 8:~m54_1 +# 44| v44_8(void) = AliasedUse : ~m44_7 +# 44| v44_9(void) = ExitFunction : + +# 44| Block 2 +# 44| v44_10(void) = Unwind : +#-----| Goto -> Block 1 -# 48| Block 1 +# 48| Block 3 # 48| r48_1(glval) = VariableAddress[#throw48:13] : # 48| r48_2(int) = Constant[1] : # 48| m48_3(int) = Store[#throw48:13] : &:r48_1, r48_2 # 48| v48_4(void) = ThrowValue : &:r48_1, m48_3 +#-----| C++ Exception -> Block 6 -# 54| Block 2 -# 54| v54_1(void) = NoOp : -# 44| v44_7(void) = ReturnVoid : -# 44| v44_8(void) = AliasedUse : m44_3 -# 44| v44_9(void) = ExitFunction : +# 51| Block 4 +# 51| r51_1(int) = Constant[0] : +# 51| r51_2(bool) = CompareEQ : r51_7, r51_1 +# 51| v51_3(void) = ConditionalBranch : r51_2 +#-----| False -> Block 5 +#-----| True -> Block 9 + +# 51| Block 5 +# 51| r51_4(int) = Constant[1] : +# 51| r51_5(bool) = CompareEQ : r51_7, r51_4 +# 51| v51_6(void) = ConditionalBranch : r51_5 +#-----| False -> Block 9 +#-----| True -> Block 7 + +# 51| Block 6 +# 51| r51_7(int) = Constant[1] : +# 51| r51_8(int) = Constant[-1] : +# 51| r51_9(bool) = CompareEQ : r51_7, r51_8 +# 51| v51_10(void) = ConditionalBranch : r51_9 +#-----| False -> Block 4 +#-----| True -> Block 9 + +# 52| Block 7 +# 52| r52_1(glval) = FunctionAddress[sink] : +# 52| r52_2(glval) = VariableAddress[x] : +# 52| r52_3(int) = Load[x] : &:r52_2, m45_3 +# 52| v52_4(void) = Call[sink] : func:r52_1, 0:r52_3 +# 52| m52_5(unknown) = ^CallSideEffect : ~m44_4 +# 52| m52_6(unknown) = Chi : total:m44_4, partial:m52_5 +#-----| Goto -> Block 8 +#-----| SEH Exception -> Block 2 + +# 54| Block 8 +# 54| m54_1(unknown) = Phi : from 0:~m44_4, from 7:~m52_6 +# 54| v54_2(void) = NoOp : +# 44| v44_11(void) = ReturnVoid : +#-----| Goto -> Block 1 -# 44| Block 3 -# 44| v44_10(void) = Unreached : +# 44| Block 9 +# 44| v44_12(void) = Unreached : diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 764cfcf879b2..7f10f2f9d7c9 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 764cfcf879b2..7f10f2f9d7c9 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 7c4ef1f7e7ea..0e6d67a5ae9a 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction @@ -22,8 +21,6 @@ lostReachability backEdgeCountMismatch useNotDominatedByDefinition | ir.cpp:1535:8:1535:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1535:8:1535:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | -| try_except.cpp:51:15:51:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | -| try_except.cpp:51:15:51:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated 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 cbdce21c7460..dfaea0dc04e4 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -37381,6 +37381,7 @@ try_except.cpp: # 48| r48_2(int) = Constant[1] : # 48| mu48_3(int) = Store[#throw48:13] : &:r48_1, r48_2 # 48| v48_4(void) = ThrowValue : &:r48_1, ~m? +#-----| C++ Exception -> Block 6 # 51| Block 4 # 51| r51_1(int) = Constant[0] : diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 764cfcf879b2..7f10f2f9d7c9 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 764cfcf879b2..7f10f2f9d7c9 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,7 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| try_except.cpp:48:13:48:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | try_except.cpp:44:6:44:14 | void throw_cpp(int) | void throw_cpp(int) | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction 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 331edd45b385..66f9c9c375f5 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 @@ -7,9 +7,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ms_try_mix.cpp:21:5:21:5 | Chi: c102 | Instruction 'Chi: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:38:5:38:5 | Chi: c106 | Instruction 'Chi: c106' 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) | ambiguousSuccessors unexplainedLoop 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 6436aae060cb..dc6671af8a40 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected @@ -8,9 +8,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ms_try_mix.cpp:21:5:21:5 | IndirectMayWriteSideEffect: c102 | Instruction 'IndirectMayWriteSideEffect: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:38:5:38:5 | IndirectMayWriteSideEffect: c106 | Instruction 'IndirectMayWriteSideEffect: c106' 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() | @@ -32,8 +29,6 @@ useNotDominatedByDefinition | ms_try_except.cpp:9:19:9:19 | 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) | | 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) | | 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) | -| ms_try_mix.cpp:22:15:22:39 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:22:15:22:39 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(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) | switchInstructionWithoutDefaultEdge 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 adf651b7be73..66f9c9c375f5 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 @@ -7,9 +7,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ms_try_mix.cpp:21:5:21:5 | IndirectMayWriteSideEffect: c102 | Instruction 'IndirectMayWriteSideEffect: c102' has no successors in function '$@'. | ms_try_mix.cpp:12:6:12:18 | void ms_except_mix(int) | void ms_except_mix(int) | -| ms_try_mix.cpp:38:5:38:5 | IndirectMayWriteSideEffect: c106 | Instruction 'IndirectMayWriteSideEffect: c106' 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) | ambiguousSuccessors unexplainedLoop From e76b912672d5ff7118896ccd90bdbeb5ce4dc9d9 Mon Sep 17 00:00:00 2001 From: "REDMOND\\brodes" Date: Tue, 10 Dec 2024 11:19:07 -0500 Subject: [PATCH 9/9] Removing debugging code. --- .../cpp/ir/implementation/raw/internal/TranslatedExpr.qll | 6 ------ 1 file changed, 6 deletions(-) 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 0c6c24294489..74f846d68a2c 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 @@ -17,12 +17,6 @@ private import TranslatedGlobalVar private import IRConstruction import TranslatedCall -predicate tbd(TranslatedElement e, Instruction i, string s) { - e.getInstruction(_) = i and - not exists(i.getSuccessor(_)) and - s = concat(e.getAQlClass(), ",") -} - /** * Gets the TranslatedExpr for the specified expression. If `expr` is a load or synthesized * temporary object, the result is the TranslatedExpr for the load or synthetic temporary object