public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25575]  New: some uninitialized warning disappear when compile without -O
@ 2005-12-27 12:16 lidaobing at gmail dot com
  2005-12-27 12:23 ` [Bug c/25575] " steven at gcc dot gnu dot org
  2007-06-18 14:17 ` matze at braunis dot de
  0 siblings, 2 replies; 3+ messages in thread
From: lidaobing at gmail dot com @ 2005-12-27 12:16 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

Hello,

see example:

---->
$ cat warning.c
int main()
{
  int i;
  return i;
}
$ gcc -Wall warning.c
$ gcc -Wall -O0 warning.c
$ gcc -Wall -O warning.c
warning.c: In function ‘main’:
warning.c:4: warning: ‘i’ is used uninitialized in this function
warning.c
$ gcc -Wall -O1 warning.c
warning.c: In function ‘main’:
warning.c:4: warning: ‘i’ is used uninitialized in this function
$ gcc -Wall -O2 warning.c
warning.c: In function ‘main’:
warning.c:4: warning: ‘i’ is used uninitialized in this function
$ gcc -Wall -O3 warning.c
warning.c: In function ‘main’:
warning.c:4: warning: ‘i’ is used uninitialized in this function
$
<------


-- 
           Summary: some uninitialized warning disappear when compile
                    without -O
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lidaobing at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25575


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/25575] some uninitialized warning disappear when compile without -O
  2005-12-27 12:16 [Bug c/25575] New: some uninitialized warning disappear when compile without -O lidaobing at gmail dot com
@ 2005-12-27 12:23 ` steven at gcc dot gnu dot org
  2007-06-18 14:17 ` matze at braunis dot de
  1 sibling, 0 replies; 3+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-27 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from steven at gcc dot gnu dot org  2005-12-27 12:22 -------
That happens because data flow information is used to find uninitialized
variables.  Some folks argue that this by itself is a bug, and that it should
be entirely up to the front end to diagnose uninitialized variables.  But then
a lot of warnings could not be issued because the front ends don't have the
means to compute which variables are initialized on one path through the
program but not on another.

In short, this is the result of a design decision.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25575


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/25575] some uninitialized warning disappear when compile without -O
  2005-12-27 12:16 [Bug c/25575] New: some uninitialized warning disappear when compile without -O lidaobing at gmail dot com
  2005-12-27 12:23 ` [Bug c/25575] " steven at gcc dot gnu dot org
@ 2007-06-18 14:17 ` matze at braunis dot de
  1 sibling, 0 replies; 3+ messages in thread
From: matze at braunis dot de @ 2007-06-18 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from matze at braunis dot de  2007-06-18 14:17 -------
Why don't you turn on dataflow computation to get the warning even with -O0?
-O0 is typically used for developing/debugging, so as a user I want to see all
possible warnings...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25575


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-18 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-27 12:16 [Bug c/25575] New: some uninitialized warning disappear when compile without -O lidaobing at gmail dot com
2005-12-27 12:23 ` [Bug c/25575] " steven at gcc dot gnu dot org
2007-06-18 14:17 ` matze at braunis dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).