https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86239
Bug ID: 86239 Summary: Suggestion: Improve "set but not used variable" warning Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pattakosn at yahoo dot com Target Milestone: --- Created attachment 44304 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44304&action=edit compiled with gcc -Wall -Wextra -pedantic Hi, I am not sure if I am right on this, but I noticed that having code like this: useless = 0; useless = useless; silences the set but not used variable warning (assume that useless is a local variable and is not used anywhere else). Now, I would agree that the second line is useless and a terrible thing to do, but still, wouldn't it better if the compiler still complained about the set but not used variable (perhaps about the useless command as well, but I do not know if it would be easy to classify identity/"useless" commands. I attach a very small file that I used to test the compiler warnings.