Skip to content

Commit 1dcac76

Browse files
committed
C++: Add a weird testcase demonstrating invalid IR.
1 parent 60aab20 commit 1dcac76

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ unexplainedLoop
2020
unnecessaryPhiInstruction
2121
memoryOperandDefinitionIsUnmodeled
2222
operandAcrossFunctions
23+
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
2324
instructionWithoutUniqueBlock
2425
containsLoopOfForwardEdges
2526
lostReachability
@@ -30,6 +31,7 @@ notMarkedAsConflated
3031
wronglyMarkedAsConflated
3132
invalidOverlap
3233
nonUniqueEnclosingIRFunction
34+
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
3335
fieldAddressOnNonPointer
3436
thisArgumentIsNonPointer
3537
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |

cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ unexplainedLoop
3333
unnecessaryPhiInstruction
3434
memoryOperandDefinitionIsUnmodeled
3535
operandAcrossFunctions
36+
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
3637
instructionWithoutUniqueBlock
3738
containsLoopOfForwardEdges
3839
lostReachability
@@ -52,6 +53,7 @@ notMarkedAsConflated
5253
wronglyMarkedAsConflated
5354
invalidOverlap
5455
nonUniqueEnclosingIRFunction
56+
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
5557
fieldAddressOnNonPointer
5658
thisArgumentIsNonPointer
5759
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |

cpp/ql/test/library-tests/syntax-zoo/test.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,14 @@ void f_if_ternary_1(int b, int x, int y) {
233233
if (b ? x : y) {
234234
}
235235
}
236+
237+
struct _A
238+
{
239+
unsigned int x;
240+
const char *y;
241+
} as[];
242+
243+
void regression_test(void)
244+
{
245+
static const void *a[] = {0 ? 0 : as};
246+
}

cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ unexplainedLoop
2020
unnecessaryPhiInstruction
2121
memoryOperandDefinitionIsUnmodeled
2222
operandAcrossFunctions
23+
| test.c:245:31:245:31 | Condition | Operand 'Condition' is used on instruction 'ConditionalBranch: 0' in function '$@', but is defined on instruction 'Constant: 0' in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> | test.c:245:24:245:24 | const void *[] a | const void *[] a |
2324
instructionWithoutUniqueBlock
2425
containsLoopOfForwardEdges
2526
lostReachability
@@ -30,6 +31,7 @@ notMarkedAsConflated
3031
wronglyMarkedAsConflated
3132
invalidOverlap
3233
nonUniqueEnclosingIRFunction
34+
| test.c:245:31:245:31 | ConditionalBranch: 0 | Instruction 'ConditionalBranch: 0' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | <Missing IRFunction> | <Missing IRFunction> |
3335
fieldAddressOnNonPointer
3436
thisArgumentIsNonPointer
3537
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |

0 commit comments

Comments
 (0)