[Bug c/33631] New: auto structure not initialized correctly
radford at blackbean dot org
gcc-bugzilla@gcc.gnu.org
Tue Oct 2 20:18:00 GMT 2007
Compiling the following (on Fedora 7 x86_64) with "-Wall -O3" gives
d.c:11: warning: Âr.c is used uninitialized in this function
and as it says, doesn't initialize the .c member though it should.
#include <stdio.h>
#include <pthread.h>
int main(int c, char **v)
{
int j[3];
struct { int c, *j; pthread_mutex_t m; } r = {
.j = j, .m = PTHREAD_MUTEX_INITIALIZER,
};
printf("current should be zero but is %d\n", r.c);
return 0;
}
$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/home/radford/local --enable-languages=c
Thread model: posix
gcc version 4.2.1
--
Summary: auto structure not initialized correctly
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: radford at blackbean dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33631
More information about the Gcc-bugs
mailing list