[Bug c/21357] New: Erroneous warning: ... may be used uninitialized in this function

2005-05-03 Thread william at gallaf dot net
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


[Bug c/21358] New: Erroneous warning: ... may be used uninitialized in this function

2005-05-03 Thread william at gallaf dot net
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=21358


[Bug c/21358] Erroneous warning: ... may be used uninitialized in this function

2005-05-03 Thread william at gallaf dot net

--- Additional Comments From william at gallaf dot net  2005-05-03 13:32 
---
Browser hung for 5 minutes after first submit without showing a bug submitted 
page, so I tried again ... apologies for noise. 

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

-- 
   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE


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


[Bug c/21357] Erroneous warning: ... may be used uninitialized in this function

2005-05-03 Thread william at gallaf dot net

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