On Wed, 9 Dec 2020 at 09:28, webmaster <webmas...@defcon-cc.org> wrote: > > Hello,I'm wondering why GCC does not throw any warning when a module global > variable is set (write) but never used (read).Is this behavior wanted? Does > it makes sense to add such warning?Greets
This question seems to be more appropriate for the gcc-help list. Please take any replies to that list instead. What do you mean by "module"? A Fortran module? A C++ module? Or do you just mean a source file? In C and C++ global variables have external linkage by default, which means they can be accessed from another translation unit (i.e. another source file). Unless the compiler knows that the entire program is a single source file, it can't know that there aren't writes to the variable in other files.