I would like to use gcc -fanalyzer across multiple c-files (*.c). E.g. given the short program
#include <string.h>
int get_buff(int id, int** buff)
{
static int empty[128];
switch(id)
{
case 0:
*buff = empty;
return 0;
default:
return -1;
}
}
int main()
{
int* from;
get_buff(1, &from);
int to[128];
memcpy(to, from, sizeof(to));
return 0;
}
will result in the following warning with gcc 14:
main.c:22:5: warning: use of uninitialized value ‘from’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
But if I put get_buff in a separate c-file (get_buff.c) then I do not get this warning when compiled with gcc -fanalyzer main.c get_buff.c. How do I use -fanalyzer with multiple compilation units?