Overlapped variables

In some cases the decompiler cannot produce nice output because the variable allocation fails. It happens because the input contains overlapped variables (or the decompiler mistakenly lumps together memory reads and writes). Overlapped variables are displayed in red so they conspicuously visible. Let us consider some typical situations.

There are read/write accesses that involve two or more variables

For example, consider the following output:

  __int64 v1; // qax@2 OVERLAPPED
  int v2; // ecx@2 OVERLAPPED
  __int64 result; // qax@4

  if ( *(_BYTE *)(a1 + 5) & 1 )
  {
    HIDWORD(v1) = *(_DWORD *)(a1 + 7);
    v2 = *(_DWORD *)(a1 + 11);
  }
  else
  {
    HIDWORD(v1) = 0;
    v2 = 0;
  }
  v1 = *(__int64 *)((char *)&v1 + 4); // ODD ASSIGNMENT!

The last assignment to v1 reads beyond v1 boundaries. In fact, it also reads v2. See the assembly code: