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

            Bug ID: 71228
           Summary: Add a warning when a variable gets initialised with
                    itself
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at linkmauve dot fr
  Target Milestone: ---

When a variable is initialised with itself, -Wuninitialized should emit a
warning since the variable wasn’t initialised at the time of this assignment.

The code in question (fix at https://github.com/SirCmpwn/aerc/pull/2.patch) can
be summarised this way (assuming -Wno-unused-parameter):

void test(int _value) {
  int value = value;
}

For reference, clang 3.8.0 gives this warning:
warning: variable 'value' is uninitialized when used within its own
initialization [-Wuninitialized]

Reply via email to