[Bug c/14739] New: Silently allows initializing a variable to itself (int i = i + 1)

anders at kaseorg dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 26 04:22:00 GMT 2004


If I wrote int i = i + 1, I'd expect to get an error or at least a warning, but
GCC doesn't give a peep even with -Wall. Instead it proceeds to increment an
uninitialized register and store it to i. Maybe there's some reason for this,
but I don't see it.

Tested with GCC 3.3.3-3 on Fedora Core development and 2.96-113 on Red Hat 7.3.

-- 
           Summary: Silently allows initializing a variable to itself (int i
                    = i + 1)
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anders at kaseorg dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-redhat-linux


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



More information about the Gcc-bugs mailing list