зеркало из https://github.com/github/codeql.git
CPP: Add a test.
This commit is contained in:
Родитель
67d4099e3f
Коммит
02a060fbfa
|
@ -1,3 +1,7 @@
|
||||||
| test.cpp:50:19:50:19 | p | This pointer might have type $@ (size 8), but the pointer arithmetic here is done with type int * (size 4). | test.cpp:45:11:45:11 | test.cpp:45:11:45:11 | double |
|
| test.cpp:50:19:50:19 | p | This pointer might have type $@ (size 8), but the pointer arithmetic here is done with type int * (size 4). | test.cpp:45:11:45:11 | test.cpp:45:11:45:11 | double |
|
||||||
| test.cpp:94:18:94:18 | x | This pointer might have type $@ (size 4), but the pointer arithmetic here is done with type short * (size 2). | test.cpp:88:21:88:21 | test.cpp:88:21:88:21 | int |
|
| test.cpp:94:18:94:18 | x | This pointer might have type $@ (size 4), but the pointer arithmetic here is done with type short * (size 2). | test.cpp:88:21:88:21 | test.cpp:88:21:88:21 | int |
|
||||||
| test.cpp:130:27:130:29 | arr | This pointer might have type $@ (size 4), but the pointer arithmetic here is done with type short * (size 2). | test.cpp:128:16:128:18 | test.cpp:128:16:128:18 | int |
|
| test.cpp:130:27:130:29 | arr | This pointer might have type $@ (size 4), but the pointer arithmetic here is done with type short * (size 2). | test.cpp:128:16:128:18 | test.cpp:128:16:128:18 | int |
|
||||||
|
| test_large.cpp:9:22:9:24 | ptr | This pointer might have type $@ (size 8), but the pointer arithmetic here is done with type MyStruct * (size 16). | test_large.cpp:7:21:7:23 | test_large.cpp:7:21:7:23 | MyStruct |
|
||||||
|
| test_large.cpp:9:22:9:24 | ptr | This pointer might have type $@ (size 8), but the pointer arithmetic here is done with type MyStruct * (size 16). | test_small.cpp:10:21:10:23 | test_small.cpp:10:21:10:23 | MyStruct |
|
||||||
|
| test_small.cpp:12:22:12:24 | ptr | This pointer might have type $@ (size 16), but the pointer arithmetic here is done with type MyStruct * (size 8). | test_large.cpp:7:21:7:23 | test_large.cpp:7:21:7:23 | MyStruct |
|
||||||
|
| test_small.cpp:12:22:12:24 | ptr | This pointer might have type $@ (size 16), but the pointer arithmetic here is done with type MyStruct * (size 8). | test_small.cpp:10:21:10:23 | test_small.cpp:10:21:10:23 | MyStruct |
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
struct MyStruct
|
||||||
|
{
|
||||||
|
int x, y, z, w;
|
||||||
|
};
|
||||||
|
|
||||||
|
void test(MyStruct *ptr)
|
||||||
|
{
|
||||||
|
MyStruct *new_ptr = ptr + 1; // GOOD [FALSE POSITIVE]
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
// note the two different `MyStruct` definitions, in test_small.cpp and test_large.cpp. These are
|
||||||
|
// in different translation units and we assume they are never linked into the same program (which
|
||||||
|
// would result in undefined behaviour).
|
||||||
|
|
||||||
|
struct MyStruct
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
};
|
||||||
|
|
||||||
|
void test(MyStruct *ptr)
|
||||||
|
{
|
||||||
|
MyStruct *new_ptr = ptr + 1; // GOOD [FALSE POSITIVE]
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче