Files
codeql/cpp/ql/test/library-tests/dataflow/dataflow-tests/example.c
Mathias Vorreiter Pedersen 9b2019db6b C++: Accept test changes.
2024-02-16 13:10:41 +01:00

30 lines
451 B
C

typedef struct
{
int x, y;
} MyCoords;
int getX(MyCoords *coords);
void doSomething(void *something);
typedef struct
{
char isTrue;
} MyBool;
void myTest_with_local_flow(MyBool *b, int pos) // $ ast-def=b ir-def=*b
{
MyCoords coords = {0};
if (b->isTrue) {
goto next;
}
next:
coords.x = coords.y = pos + 1;
// There is flow from `{0}` to `coords` in `&coords` on the next line.
coords.x = getX(&coords);
doSomething((void *)&pos);
}