Skip to content

Commit a8895f4

Browse files
author
Robert Marsh
committed
C++: Support crement ops in HashCons
1 parent cf222c5 commit a8895f4

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

cpp/ql/src/semmle/code/cpp/valuenumbering/HashCons.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ private predicate mk_BinaryOp(
287287

288288
private predicate analyzableUnaryOp(UnaryOperation op) {
289289
not (op instanceof PointerDereferenceExpr) and
290-
op.isPure() and
291290
strictcount (op.getOperand().getFullyConverted()) = 1 and
292291
strictcount (op.getOperator()) = 1
293292
}

cpp/ql/test/library-tests/valuenumbering/HashCons/HashCons.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| test.cpp:79:11:79:14 | vals | 79:c11-c14 79:c24-c27 |
3535
| test.cpp:92:11:92:11 | x | 92:c11-c11 93:c10-c10 |
3636
| test.cpp:97:3:97:3 | x | 97:c3-c3 98:c3-c3 |
37+
| test.cpp:97:3:97:5 | ... ++ | 97:c3-c5 98:c3-c5 |
3738
| test.cpp:103:10:103:11 | 1 | 103:c10-c11 104:c7-c7 107:c7-c7 108:c7-c7 10:c16-c16 |
3839
| test.cpp:104:3:104:3 | x | 104:c3-c3 105:c3-c3 106:c3-c3 107:c3-c3 108:c3-c3 |
3940
| test.cpp:105:7:105:7 | 2 | 105:c7-c7 106:c7-c7 107:c11-c11 108:c11-c11 21:c16-c16 |

cpp/ql/test/library-tests/valuenumbering/HashCons/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int regression_test00() {
9595

9696
void test06(int x) {
9797
x++;
98-
x++; // x is matched but x++ is not matched?
98+
x++; // x++ is matched
9999
}
100100

101101
// literals

0 commit comments

Comments
 (0)