https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77428
Bug ID: 77428 Summary: incorrect 'set but not used' warning with @throw Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: objc Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- test.m: ... #import <objc/Object.h> #import <stdio.h> void foo2 (void) { printf ("foo2\n"); } int main (void) { id o = nil; @try { printf ("before throw\n"); @throw o; printf ("after throw\n"); } @catch (id ue) { if (ue != nil) foo2 (); else printf ("not foo2\n"); } return 0; } ... $ gcc test.m -fobjc-exceptions -lobjc -Wall: ... test.m: In function ‘main’: test.m:13:6: warning: variable ‘o’ set but not used [-Wunused-but-set-variable] id o = nil; ^ ... The warning is incorrect, variable 'o' is in fact used by @throw.