This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/57258] New: unused variable warning is emitted for volatile variables
- From: "nszabolcs at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 12 May 2013 20:31:52 +0000
- Subject: [Bug c/57258] New: unused variable warning is emitted for volatile variables
- Auto-submitted: auto-generated
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;
^