Bug 168912

Summary: bogus gcc4.0.1 "may be used uninitialized" warnings
Product: [Fedora] Fedora Reporter: Dan Hollis <goemon>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4Keywords: Regression
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-21 08:44:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
gcc4 bogus warning test case none

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.