From e4a8d533daa74649fd43ad505ea7ec2ec7c680fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Tue, 19 Mar 2019 16:56:34 +0200 Subject: sna/fb: Use memcpy() to avoid strict aliasing violations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the cast+deref with memcpy() so that we don't upset the compiler's strict aliasing rules. Signed-off-by: Ville Syrjälä --- src/sna/fb/fbspan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sna/fb/fbspan.c b/src/sna/fb/fbspan.c index 45cb7cc7..18136c20 100644 --- a/src/sna/fb/fbspan.c +++ b/src/sna/fb/fbspan.c @@ -39,12 +39,13 @@ fbFillSpans(DrawablePtr drawable, GCPtr gc, while (n--) { BoxRec box; - *(DDXPointPtr)&box = *pt++; + memcpy(&box, pt, sizeof(box)); box.x2 = box.x1 + *width++; box.y2 = box.y1 + 1; /* XXX fSorted */ fbDrawableRun(drawable, gc, &box, fbFillSpan, NULL); + pt++; } } @@ -91,7 +92,8 @@ fbSetSpans(DrawablePtr drawable, GCPtr gc, while (n--) { BoxRec box; - *(DDXPointPtr)&box = data.pt = *pt; + memcpy(&box, pt, sizeof(box)); + data.pt = *pt; box.x2 = box.x1 + *width; box.y2 = box.y1 + 1; -- cgit v1.2.3