[Bug c/12651] New: Able to use a variable before it is defined
erickt at andrew dot cmu dot edu
gcc-bugzilla@gcc.gnu.org
Thu Oct 16 21:42:00 GMT 2003
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.
More information about the Gcc-bugs
mailing list