Bug 168912 - bogus gcc4.0.1 "may be used uninitialized" warnings
Summary: bogus gcc4.0.1 "may be used uninitialized" warnings
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-09-21 08:37 UTC by Dan Hollis
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-21 08:44:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
gcc4 bogus warning test case (1012 bytes, text/plain)
2005-09-21 08:37 UTC, Dan Hollis
no flags Details

Description Dan Hollis 2005-09-21 08:37:23 UTC
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)

Comment 1 Dan Hollis 2005-09-21 08:37:23 UTC
Created attachment 119067 [details]
gcc4 bogus warning test case

Comment 2 Jakub Jelinek 2005-09-21 08:44:05 UTC
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.

Comment 3 Dan Hollis 2005-09-21 08:53:44 UTC
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.

Comment 4 Jakub Jelinek 2005-09-21 08:58:09 UTC
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.



Note You need to log in before you can comment on or make changes to this bug.