Bug 12153 - uninitialized use not spotted in "T x = x;"
Summary: uninitialized use not spotted in "T x = x;"
Status: RESOLVED DUPLICATE of bug 5582
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3.1
: P3 minor
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-03 13:50 UTC by Simon Marshall
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Marshall 2003-09-03 13:50:41 UTC
With the program:

#include <stdio.h>
int main ()
{
    int x = x;
    printf ("x=%d\n", x);
    return 0;
}

gcc -O -W -Wall does not report the use of x before initialisation (as it would 
at the printf() if it had been "int x;").

Obscure I know, but we had a C++ code typo of this form which gcc should have 
spotted.
Comment 1 Wolfgang Bangerth 2003-09-03 14:12:01 UTC
This is already fixed in mainline, which gives 
  tmp/g> ../build-gcc/gcc-install/bin/gcc -Winit-self -c x.c -O -W -Wall 
  x.c: In function `main': 
  x.c:4: warning: 'x' might be used uninitialized in this function 
 
W. 
Comment 2 Andrew Pinski 2003-10-16 21:47:11 UTC
Reopening bug to mark as a dup of ...
Comment 3 Andrew Pinski 2003-10-16 21:47:32 UTC
bug 5582 which I fixed.

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