$ cat /etc/fedora-release Fedora Core release 4 (Stentz)
$ uname -a Linux host 2.6.13.1 #4 Sat Sep 17 10:57:37 PDT 2005 x86_64 x86_64 x86_64 GNU/Linux $ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=x86_64-redhat-linux Thread model: posix gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) testcase.c: =========== #include <math.h> typedef float vec_t; typedef vec_t vec3_t[3]; void VectorSubtract( const vec3_t veca, const vec3_t vecb, vec3_t out ) { out[0] = veca[0] - vecb[0]; out[1] = veca[1] - vecb[1]; out[2] = veca[2] - vecb[2]; } void VectorCopy( const vec3_t in, vec3_t out ) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; } vec_t VectorLength( const vec3_t v ) { return sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); } float BG_SplineLength( void ) { float i; float granularity = 0.01f; float dist = 0; vec3_t vec[2]; vec3_t lastPoint; vec3_t result; for(i = 0; i <= 1.f; i += granularity ) { VectorSubtract( vec[1], vec[0], result ); if( i != 0 ) { VectorSubtract( result, lastPoint, vec[0] ); dist += VectorLength( vec[0] ); } VectorCopy( result, lastPoint ); } return dist; } int main( void ) { BG_SplineLength(); return 0; } $ gcc -O2 -Wall -o testcase testcase.c $ gcc -O3 -Wall -o testcase testcase.c testcase.c: In function BG_SplineLength: testcase.c:26: warning: lastPoint[0] may be used uninitialized in this function testcase.c:26: warning: lastPoint[1] may be used uninitialized in this function testcase.c:26: warning: lastPoint[2] may be used uninitialized in this function testcase.c: In function main: testcase.c:26: warning: lastPoint[0] may be used uninitialized in this function testcase.c:26: warning: lastPoint[1] may be used uninitialized in this function testcase.c:26: warning: lastPoint[2] may be used uninitialized in this function gcc3.2 and 3.3 don't produce these bogus warnings. -- Summary: gcc 4.0.1 gives bogus 'may be unused warnings' at -O3 Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: SLTxLQEc4vuR5kMzK at anime dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24004