[Bug c/54554] New: Undetected use of uninitialized variable

dpapavas at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Sep 12 09:16:00 GMT 2012


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

             Bug #: 54554
           Summary: Undetected use of uninitialized variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dpapavas@gmail.com


Created attachment 28176
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28176
The output of the command line used to compile the snippet to stderr.

When compiling the snippet below:

---8<------8<------8<------8<------8<------8<------8<------8<---

extern int printf (__const char *__restrict __format, ...);

int main()
{
    int j;

    for (j = 0 ; j < 10 ; j += 1) {
        int i;

        printf ("%d\n", i);
        i = 1;
    }

    return 0;
}

---8<------8<------8<------8<------8<------8<------8<------8<---

GCC fails to detect the use of an uninitialized variable.  The command line
used to compile it is:

gcc -v -save-temps -Wall -Wextra -O0 -g -ansi -pedantic foo.c

Output to stderr has been attached.  I won't attach the .i file as it simply
seems to contain a copy of the source.  Let me know if you need it.

Bug 52523 seems to be related if not identical but I'm still submitting this as
this is C code not C++.



More information about the Gcc-bugs mailing list