PATCH: large int / alias
Marcus Meissner
marcus at jet.franken.de
Sun Nov 17 16:42:49 CST 2002
Hi,
The *(ptrtypeA*)&var_type_B construct is illegal and will confuse
newer gccs, it violates 'strict aliasing' constraints.
I verified the generated assembler code.
Ciao, Marcus
Changelog:
Fixed strict aliasing problem in RtlEnlargedUnsignedDivide.
Index: dlls/ntdll/large_int.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/large_int.c,v
retrieving revision 1.4
diff -u -u -r1.4 large_int.c
--- dlls/ntdll/large_int.c 12 Sep 2002 22:07:03 -0000 1.4
+++ dlls/ntdll/large_int.c 17 Nov 2002 22:40:51 -0000
@@ -141,10 +141,14 @@
UINT WINAPI RtlEnlargedUnsignedDivide( ULONGLONG a, UINT b, UINT *remptr )
{
#if defined(__i386__) && defined(__GNUC__)
- UINT ret, rem;
+ UINT ret, rem, p1, p2;
+
+ p1 = a >> 32;
+ p2 = a & 0xffffffffLL;
+
__asm__("div %4,%%eax"
: "=a" (ret), "=d" (rem)
- : "0" (*(UINT*)&a), "1" (*((UINT*)&a+1)), "g" (b) );
+ : "0" (p2), "1" (p1), "g" (b) );
if (remptr) *remptr = rem;
return ret;
#else
More information about the wine-patches
mailing list