http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57258
Bug ID: 57258 Summary: unused variable warning is emitted for volatile variables Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nszabolcs at gmail dot com unused variable warnings are incorrectly issued for volatile variables a volatile variable is only unused if it is not accessed, otherwise code will be generated for using it following the semantics of the abstract machine in the following example the compiler gives a warning eventhough the generated code uses x: $ cat example.c void f() { volatile int x = 0; } $ gcc-4.8 -c -Wunused-variable example.c example.c: In function 'f': example.c:3:15: warning: unused variable 'x' [-Wunused-variable] volatile int x = 0; ^