mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
This change fixes a few key problems with the existing SSA implementations: For unaliased SSA, we were incorrectly choosing to model a local variable that had accesses that did not cover the entire variable. This has been changed to ensure that all accesses to the variable are at offset zero and have the same type as the variable itself. This was only possible to fix now that every `MemoryOperand` has its own type. For aliased SSA, we now correctly track the offset and size of each memory access using an interval of bit offsets covered by the access. The offset interval makes the overlap computation more straightforward. Again, this is only possible now that operands have types. The `getXXXMemoryAccess` predicates are now driven by the `MemoryAccessKind` on the operands and results, instead of by specific opcodes. This change does fix an existing false negative in the IR dataflow tests. I added a few simple test cases to the SSA IR tests, covering the various kinds of overlap (MustExcactly, MustTotally, and MayPartially). I added "PrintSSA.qll", which can dump the SSA memory accesses as part of an IR dump.
15 lines
909 B
Plaintext
15 lines
909 B
Plaintext
| test.cpp:66:30:66:36 | test.cpp:71:8:71:9 | AST only |
|
|
| test.cpp:89:28:89:34 | test.cpp:92:8:92:14 | IR only |
|
|
| test.cpp:100:13:100:18 | test.cpp:103:10:103:12 | AST only |
|
|
| test.cpp:109:9:109:14 | test.cpp:110:10:110:12 | IR only |
|
|
| test.cpp:120:9:120:20 | test.cpp:126:8:126:19 | AST only |
|
|
| test.cpp:122:18:122:30 | test.cpp:132:22:132:23 | IR only |
|
|
| test.cpp:122:18:122:30 | test.cpp:140:22:140:23 | IR only |
|
|
| test.cpp:136:27:136:32 | test.cpp:137:27:137:28 | AST only |
|
|
| test.cpp:136:27:136:32 | test.cpp:140:22:140:23 | AST only |
|
|
| test.cpp:395:17:395:22 | test.cpp:397:10:397:18 | AST only |
|
|
| test.cpp:421:13:421:18 | test.cpp:423:10:423:14 | AST only |
|
|
| true_upon_entry.cpp:9:11:9:16 | true_upon_entry.cpp:13:8:13:8 | IR only |
|
|
| true_upon_entry.cpp:62:11:62:16 | true_upon_entry.cpp:66:8:66:8 | IR only |
|
|
| true_upon_entry.cpp:98:11:98:16 | true_upon_entry.cpp:105:8:105:8 | IR only |
|