Hi, This fixes aliasing problems in objects/*.c. The (POINT*)&RECT misuse is a typical problematic example, where the optimizer is not required to catch that 'rect' might be changed by LPtoDP(). Ciao, Marcus Changelog: Fixed aliasing problems (do not use (POINT*)&rect constructs). Index: objects/clipping.c =================================================================== RCS file: /home/wine/wine/objects/clipping.c,v retrieving revision 1.41 diff -u -u -r1.41 clipping.c --- objects/clipping.c 18 Oct 2002 04:06:47 -0000 1.41 +++ objects/clipping.c 21 Nov 2002 22:29:16 -0000 @@ -194,14 +194,14 @@ ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom ); else { - RECT rect; - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; - LPtoDP( hdc, (POINT*)&rect, 2 ); + POINT pt[2]; - if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR; + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + LPtoDP( hdc, pt, 2 ); + if (!(newRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; else { if (!dc->hClipRgn) @@ -234,24 +234,25 @@ ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom ); else { - RECT rect; + POINT pt[2]; - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; - LPtoDP( hdc, (POINT*)&rect, 2 ); + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + + LPtoDP( hdc, pt, 2 ); if (!dc->hClipRgn) { - dc->hClipRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ); + dc->hClipRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ); ret = SIMPLEREGION; } else { HRGN newRgn; - if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom))) ret = ERROR; + if (!(newRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; else { ret = CombineRgn( dc->hClipRgn, dc->hClipRgn, newRgn, RGN_AND ); @@ -273,19 +274,20 @@ { HRGN tempRgn; INT16 ret; - RECT rect; + POINT pt[2]; DC * dc = DC_GetDCUpdate( hdc ); if (!dc) return ERROR; - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; - LPtoDP( hdc, (POINT*)&rect, 2 ); + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + + LPtoDP( hdc, pt, 2 ); - TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom ); + TRACE("%04x %ld,%ld - %ld,%ld\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); - if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR; + if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; else { ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF ); @@ -305,19 +307,21 @@ { HRGN tempRgn; INT16 ret; - RECT rect; + POINT pt[2]; DC * dc = DC_GetDCUpdate( hdc ); if (!dc) return ERROR; - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; - LPtoDP( hdc, (POINT*)&rect, 2 ); + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + + LPtoDP( hdc, pt, 2 ); - TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom ); + TRACE("%04x %ld,%ld - %ld,%ld\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); - if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR; + + if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; else { ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND ); @@ -359,16 +363,24 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect ) { BOOL ret = FALSE; - RECT tmpRect; DC *dc = DC_GetDCUpdate( hdc ); if (!dc) return FALSE; TRACE("%04x %d,%dx%d,%d\n", hdc, rect->left, rect->top, rect->right, rect->bottom ); if (dc->hGCClipRgn) { - /* copy rectangle to avoid overwriting by LPtoDP */ - tmpRect = *rect; - LPtoDP( hdc, (LPPOINT)&tmpRect, 2 ); + POINT pt[2]; + RECT tmpRect; + + pt[0].x = rect->left; + pt[0].y = rect->top; + pt[1].x = rect->right; + pt[1].y = rect->bottom; + LPtoDP( hdc, pt, 2 ); + tmpRect.left = pt[0].x; + tmpRect.top = pt[0].y; + tmpRect.right = pt[1].x; + tmpRect.bottom = pt[1].y; ret = RectInRegion( dc->hGCClipRgn, &tmpRect ); } GDI_ReleaseObj( hdc ); Index: objects/enhmetafile.c =================================================================== RCS file: /home/wine/wine/objects/enhmetafile.c,v retrieving revision 1.62 diff -u -u -r1.62 enhmetafile.c --- objects/enhmetafile.c 4 Nov 2002 22:43:24 -0000 1.62 +++ objects/enhmetafile.c 21 Nov 2002 22:29:18 -0000 @@ -302,7 +302,7 @@ ) { int type; - RECT tmprc; + POINT pt[2]; TRACE( "hdc = %08x, handletable = %p, record = %p, numHandles = %d\n", @@ -1565,11 +1565,12 @@ FIXME("type %d is unimplemented\n", type); break; } - tmprc.left = tmprc.top = 0; - tmprc.right = tmprc.bottom = 1000; - LPtoDP(hdc, (POINT*)&tmprc, 2); - TRACE("L:0,0 - 1000,1000 -> D:%d,%d - %d,%d\n", tmprc.left, - tmprc.top, tmprc.right, tmprc.bottom); + + pt[0].x = pt[0].y = 0; + pt[1].x = pt[1].y = 1000; + LPtoDP(hdc, pt, 2); + TRACE("L:0,0 - 1000,1000 -> D:%ld,%ld - %ld,%ld\n", pt[0].x, pt[0].y, + pt[1].x, pt[1].y); return TRUE; } @@ -1611,7 +1612,7 @@ HPEN hPen = (HPEN)NULL; HBRUSH hBrush = (HBRUSH)NULL; HFONT hFont = (HFONT)NULL; - RECT tmprc; + POINT pt[2]; if(!lpRect) { @@ -1670,11 +1671,11 @@ hFont = GetCurrentObject(hdc, OBJ_FONT); } - tmprc.left = tmprc.top = 0; - tmprc.right = tmprc.bottom = 1000; - LPtoDP(hdc, (POINT*)&tmprc, 2); - TRACE("L:0,0-1000,1000 maps to D:%d,%d - %d,%d\n", tmprc.left, tmprc.top, - tmprc.right, tmprc.bottom); + pt[0].x = pt[0].y = 0; + pt[1].x = pt[1].y = 1000; + LPtoDP(hdc, pt, 2); + TRACE("L:0,0-1000,1000 maps to D:%ld,%ld - %ld,%ld\n", pt[0].x, pt[0].y, + pt[1].x, pt[1].y); TRACE("nSize = %ld, nBytes = %ld, nHandles = %d, nRecords = %ld, nPalEntries = %ld\n", emh->nSize, emh->nBytes, emh->nHandles, emh->nRecords, emh->nPalEntries);