mingw-builds-binaries icon indicating copy to clipboard operation
mingw-builds-binaries copied to clipboard

Peculiar printf() behaviour, i686 version of mingw

Open ChristianIvarsson opened this issue 4 months ago • 0 comments

Hi everyone! I've noticed some really weird quirks with functions that utilise va_list et. al Looks like values are extended to 64-bit before being pushed onto the stack and then interpreted as 32-bit on the other end? All values are fixed point integers btw. Just in case someone picks up on vertex and thinks "float".

I suspect the answer is "stop targeting old crusty 32-bit junk" but I figured I'd file an issue just in case 😄

Compiler versions tested:

  • i686-14.2.0-release-posix-dwarf-msvcrt-rt_v12-rev0
  • i686-14.1.0-release-posix-dwarf-msvcrt-rt_v12-rev0
  • i686-13.2.0-release-posix-dwarf-msvcrt-rt_v11-rev1

OS versions tested:

  • Windows 10, x64. Not entirely sure of build number but it's up to date
  • Windows 8, 32-bit.
printf("Vertex 0 V{ %d, %d, %d } U{ %u, %u }\n",
    point0->vertex.X, point0->vertex.Y, point0->vertex.Z,
    point0->uv.U, point0->uv.V);

// Incorrect
> Vertex 0 V{ 184, 0, 274 } U{ 0, 19293 }


printf("Vertex 0 X %d\n", point0->vertex.X);
printf("Vertex 0 Y %d\n", point0->vertex.Y);
printf("Vertex 0 Z %d\n", point0->vertex.Z);
printf("Vertex 0 U %u\n", point0->uv.U);
printf("Vertex 0 V %u\n", point0->uv.V);

// Expected values
> Vertex 0 X 184
> Vertex 0 Y 274
> Vertex 0 Z 19293
> Vertex 0 U 49
> Vertex 0 V 68

ChristianIvarsson avatar Oct 04 '24 06:10 ChristianIvarsson