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

            Bug ID: 98879
           Summary: gcc/ada/terminals.c:732: redundantAssignment ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

trunk.git/gcc/ada/terminals.c:732:10: style: Variable 'cpid' is reassigned a
value before the old one has been used. [redundantAssignment]

Source code is

    bRet = ReadFile(process->w_outfd, buf, 8, &count, NULL);
    if (bRet == FALSE) {
      cpid = -1;
    }

    dwRet = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
    if (dwRet != 0) {
      cpid = -1;
    }

    cpid = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24);
    process->pid = cpid;

Why bother setting cpid if it is ignored a few lines later ?

Reply via email to