Fix strict aliasing

Fix a strict aliasing error detected by gcc 6.0+

winsup/cygwin/ChangeLog
* pinfo.cc (winpids::enum_process): Fix strict aliasing.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
This commit is contained in:
Peter Foley 2016-03-19 13:45:56 -04:00 committed by Corinna Vinschen
parent 0611132f04
commit 5bc753c5a2
1 changed files with 1 additions and 2 deletions

View File

@ -1391,14 +1391,13 @@ winpids::enum_processes (bool winpid)
}
PSYSTEM_PROCESS_INFORMATION px = procs;
char *&pxc = (char *&)px;
while (1)
{
if (px->UniqueProcessId)
add (nelem, true, (DWORD) (uintptr_t) px->UniqueProcessId);
if (!px->NextEntryOffset)
break;
pxc += px->NextEntryOffset;
px = (PSYSTEM_PROCESS_INFORMATION) ((char *) px + px->NextEntryOffset);
}
}
return nelem;