public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21357] New: Erroneous warning: " ... may be used uninitialized in this function"
@ 2005-05-03 13:08 william at gallaf dot net
  2005-05-03 13:33 ` [Bug c/21357] " william at gallaf dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: william at gallaf dot net @ 2005-05-03 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

Output of gcc -v: 
 
Using built-in specs. 
Target: x86_64-unknown-linux-gnu 
Configured with: ../gcc-4.0.0/configure --prefix=/home/williamg/local/x86_64-40 
--enable-__cxa_atexit --enable-languages=c,c++ 
Thread model: posix 
gcc version 4.0.0 
 
Command line: 
~/local/x86_64-40/bin/gcc -O1 -Wall -Werror -c 3.c -o 3.o 
 
Output: 
cc1: warnings being treated as errors 
3.c: In function ‘main’: 
3.c:6: warning: ‘initialised_when_a_is_non_zero’ may be used uninitialized in 
this function 
 
Preprocessed source: 
 
# 1 "3.c" 
# 1 "<built-in>" 
# 1 "<command line>" 
# 1 "3.c" 
 
extern int g (int); 
 
int main () { 
 const int a = g (0); 
 int initialised_when_a_is_non_zero; 
 if (a) 
  initialised_when_a_is_non_zero = 10; 
 g (1); 
 if (a) 
  g (initialised_when_a_is_non_zero); 
 return 0; 
} 
 
It's clearly impossible that we use initialised_when_a_is_non_zero unless it 
has been initialised. 
 
The warning does not appear with -O0. 
 
Removing the line "g (1);" also makes the warning disappear.

-- 
           Summary: Erroneous warning: " ... may be used uninitialized in
                    this function"
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: william at gallaf dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c/21357] Erroneous warning: " ... may be used uninitialized in this function"
  2005-05-03 13:08 [Bug c/21357] New: Erroneous warning: " ... may be used uninitialized in this function" william at gallaf dot net
@ 2005-05-03 13:33 ` william at gallaf dot net
  2005-05-03 13:43 ` pinskia at gcc dot gnu dot org
  2005-05-03 20:20 ` [Bug tree-optimization/21357] " jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: william at gallaf dot net @ 2005-05-03 13:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From william at gallaf dot net  2005-05-03 13:32 -------
*** Bug 21358 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug c/21357] Erroneous warning: " ... may be used uninitialized in this function"
  2005-05-03 13:08 [Bug c/21357] New: Erroneous warning: " ... may be used uninitialized in this function" william at gallaf dot net
  2005-05-03 13:33 ` [Bug c/21357] " william at gallaf dot net
@ 2005-05-03 13:43 ` pinskia at gcc dot gnu dot org
  2005-05-03 20:20 ` [Bug tree-optimization/21357] " jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-03 13:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-03 13:43 -------
This is known and a long standing bug.

-- 


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


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

* [Bug tree-optimization/21357] Erroneous warning: " ... may be used uninitialized in this function"
  2005-05-03 13:08 [Bug c/21357] New: Erroneous warning: " ... may be used uninitialized in this function" william at gallaf dot net
  2005-05-03 13:33 ` [Bug c/21357] " william at gallaf dot net
  2005-05-03 13:43 ` pinskia at gcc dot gnu dot org
@ 2005-05-03 20:20 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-05-03 20:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-05-03 20:20 -------
Not a C front end bug and previously reported more than once.


*** This bug has been marked as a duplicate of 5035 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |tree-optimization
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-05-03 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-03 13:08 [Bug c/21357] New: Erroneous warning: " ... may be used uninitialized in this function" william at gallaf dot net
2005-05-03 13:33 ` [Bug c/21357] " william at gallaf dot net
2005-05-03 13:43 ` pinskia at gcc dot gnu dot org
2005-05-03 20:20 ` [Bug tree-optimization/21357] " jsm28 at gcc dot gnu dot org

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).