Description of problem: gcc4.0.1 generates bogus "may be used uninitialized" warnings. gcc32 and gcc33 does not. Version-Release number of selected component (if applicable): How reproducible: always Steps to Reproduce: 1.gcc -O3 -Wall -o testcase testcase.c -lm 2. 3. Actual results: 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 Expected results: no warnings Additional info: gcc -O2 does not produce these warnings. $ 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)
Created attachment 119067 [details] gcc4 bogus warning test case
The warning says it may be unitialized, not that it is unitialized. Making the warning 100% accurrate is NP-complete problem, GCC just uses a simple algorithm.
ok, how do i tell gcc to ignore the error for just that portion of code where I know it fails? i don't want to ignore warnings for entire sourcefiles. gcc before 4.0.1 didn't produce this error.
Warnings are selectable just on a compilation unit granularity ATM, so no, you can't disable the warnings just for a part of the file.