http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50179
Bug #: 50179
Summary: wrong "set but not used" warning
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
To me it looks like the warning below is not correct. The variable is in fact
used.
$ gcc-4.6 -c -o bug.o bug.c -Wall
bug.c: In function ‘huh’:
bug.c:5:15: warning: variable ‘b__’ set but not used
[-Wunused-but-set-variable]
$ cat bug.c
#include <stdio.h>
void huh(void) {
printf("%s", (__extension__(
{
static char b__[129];
b__[0] = 1;
b__[1] = 2;
b__[2] = 0;
b__;
}))
);
}