This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12651] New: Able to use a variable before it is defined
- From: "erickt at andrew dot cmu dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2003 21:42:42 -0000
- Subject: [Bug c/12651] New: Able to use a variable before it is defined
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12651
Summary: Able to use a variable before it is defined
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: erickt at andrew dot cmu dot edu
CC: gcc-bugs at gcc dot gnu dot org
int main ()
{
int i = i + 5;
return 0;
}
compiles with:
gcc -Wall foo.c -o foo;
Is valid code. This appears to work with any variable.
I think there should be a warning, or compile error to prevent this from occuring.