Bug 168912 - bogus gcc4.0.1 "may be used uninitialized" warnings
bogus gcc4.0.1 "may be used uninitialized" warnings
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: gcc4 (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-21 04:37 EDT by Dan Hollis
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-21 04:44:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Dan Hollis 2005-09-21 04:37:23 EDT
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 04:37:23 EDT
Created attachment 119067 [details]
gcc4 bogus warning test case
Comment 2 Jakub Jelinek 2005-09-21 04:44:05 EDT
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 04:53:44 EDT
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 04:58:09 EDT
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.