[Bug c/14876] New: Incorrectly resolved variable scope in initializer

eckart at icd dot de gcc-bugzilla@gcc.gnu.org
Wed Apr 7 13:10:00 GMT 2004


Dear folks,

when compiling the following program:

int A=3;

int f()
{
  int A=A+2;

  return A;
}

it seems as if gcc does not take global 'A' for initialization of local 'A'. The
effect is, that local 'A' is initialized with some arbitrary value, i.e. it
seems to take local 'A' even in the initializer expression. This seems to happen
with a symbol from any outer scope, i.e. not only from an outer global scope as
in this example but with outer compound scopes as well.

Best regards,

Jörg Eckart

-- 
           Summary: Incorrectly resolved variable scope in initializer
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eckart at icd dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: Configured with: ../configure --enable-threads=posix --
                    prefix=/u
  GCC host triplet: Linux ls12pc4 2.4.19-4GB #1 Fri Sep 13 13:14:56 UTC 2002
                    i686 un


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



More information about the Gcc-bugs mailing list