[Bug c/81208] New: 'uninitialized' warning is missed while self initializing

streletsaa at mail dot ru gcc-bugzilla@gcc.gnu.org
Mon Jun 26 14:06:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81208

            Bug ID: 81208
           Summary: 'uninitialized' warning is missed while self
                    initializing
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: streletsaa at mail dot ru
  Target Milestone: ---

Created attachment 41630
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41630&action=edit
example project that reproduces the bug

The following code does not produce an 'uninitialized' warning in gcc for 'px':

{
    int x = 3, *px = &x;
    printf("main: %p\n", px);   // suppress 'unused variable px'

    do {
        int *px = px;    // <--- here must be a WARNING
        ...
    } while(0);
}

See the attached project for more details.

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Linux ubuntu 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux


More information about the Gcc-bugs mailing list