This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/12651] New: Able to use a variable before it is defined


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]