C++: Fix FP by special-casing compound assignments in 'asExprInternal'.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-12-04 11:29:51 +00:00
parent ce28c9b485
commit 359b15bb60
3 changed files with 2 additions and 3 deletions

View File

@@ -2069,7 +2069,7 @@ module ExprFlowCached {
result = n.asExpr()
or
result = n.asDefinition() and
result instanceof CrementOperation
(result instanceof CrementOperation or result instanceof AssignOperation)
)
}

View File

@@ -49,7 +49,6 @@
| tests.cpp:577:7:577:13 | access to array | This array indexing operation accesses a negative index -1 on the $@. | tests.cpp:565:7:565:12 | buffer | array |
| tests.cpp:637:6:637:15 | access to array | This array indexing operation accesses a negative index -1 on the $@. | tests.cpp:633:7:633:12 | buffer | array |
| tests.cpp:645:7:645:13 | access to array | This array indexing operation accesses a negative index -1 on the $@. | tests.cpp:633:7:633:12 | buffer | array |
| tests.cpp:654:6:654:12 | access to array | This array indexing operation accesses a negative index -1 on the $@. | tests.cpp:633:7:633:12 | buffer | array |
| tests_restrict.c:12:2:12:7 | call to memcpy | This 'memcpy' operation accesses 2 bytes but the $@ is only 1 byte. | tests_restrict.c:7:6:7:13 | smallbuf | source buffer |
| unions.cpp:26:2:26:7 | call to memset | This 'memset' operation accesses 200 bytes but the $@ is only 100 bytes. | unions.cpp:21:10:21:11 | mu | destination buffer |
| unions.cpp:30:2:30:7 | call to memset | This 'memset' operation accesses 200 bytes but the $@ is only 100 bytes. | unions.cpp:15:7:15:11 | small | destination buffer |

View File

@@ -651,7 +651,7 @@ void test26(bool cond)
{
ptr += 1;
}
if (ptr[-1] == 0) { return; } // GOOD: accesses buffer[1] [FALSE POSITIVE]
if (ptr[-1] == 0) { return; } // GOOD: accesses buffer[1]
}
int tests_main(int argc, char *argv[])