GCC issues -Wunused-but-set-parameter for function arguments used only as the left operand of ordinary assignment expressions but it fails to diagnose any other equivalent forms of modifications whose result is unused, including compound assignment and increment. It should diagnose all such expressions. $ cat x.c && gcc -S -Wall -Wextra -Wunused-but-set-parameter x.c void f8 (int *p) { p = 0; // -Wunused-but-set-parameter (expected) } void f1 (int *p) { p += 1; // missing warning } void f2 (int *p) { p = p + 1; // missing warning } void f3 (int *p) { ++p; // missing warning } x.c: In function ‘f8’: x.c:1:15: warning: parameter ‘p’ set but not used [-Wunused-but-set-parameter] 1 | void f8 (int *p) | ~~~~~^
This should probably be handled at the same time as pr64639, so making it a dupe. *** This bug has been marked as a duplicate of bug 64639 ***