typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long upad64_t;
typedef struct _pthread_mutex { struct { uint16_t __pthread_mutex_flag1; uint8_t __pthread_mutex_flag2; uint8_t __pthread_mutex_ceiling; uint16_t __pthread_mutex_type; uint16_t __pthread_mutex_magic; } __pthread_mutex_flags; union { struct { uint8_t __pthread_mutex_pad[8]; } __pthread_mutex_lock64; struct { uint32_t __pthread_ownerpid; uint32_t __pthread_lockword; } __pthread_mutex_lock32; upad64_t __pthread_mutex_owner64; } __pthread_mutex_lock; upad64_t __pthread_mutex_data; } pthread_mutex_t; void foo(void) { pthread_mutex_t tmp = {{0, 0, 0, 0, 0x4d58}, {{{0}}}, 0}; } On SPARC64 at -O0: sth %g0, [%fp+2007] stb %g0, [%fp+2009] stb %g0, [%fp+2010] sth %g0, [%fp+2011] sethi %hi(19456), %g1 or %g1, 344, %g1 sth %g1, [%fp+2013] stb %g0, [%fp+2015] stx %g0, [%fp+2023] On AMD64 at -O0: movw $0, -32(%rbp) movb $0, -30(%rbp) movb $0, -29(%rbp) movw $0, -28(%rbp) movw $19800, -26(%rbp) movb $0, -24(%rbp) movq $0, -16(%rbp) Note the 'b' on the last but one line in both cases: __pthread_mutex_pad is not initialized according to the ISO C99 rules. This is critical on Solaris 64-bit as it affects POSIX thread support. The C++ and Objective-C compilers are also affected. -- Summary: [4.0 Regression] Violation of C99 6.7.8 §21 Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ebotcazou at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: *-*-* GCC host triplet: *-*-* GCC target triplet: *-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19515