I know this is likely cumbersome to support as a case, as it requires to look at all the functions in the given unit to report it, but since GCC already reports unused functions in the unit I guess it is feasible. Simple test case: static unsigned int done = 0; int main() { done = 1; return 0; } The warning works fine if done is function-static though. Thanks, Diego
To do this warning, we need an IPA pass which goes through all static referenced variables and see if they are only written to.