[PATCH xf86-video-intel 14/21] sna/fb: Use memcpy() to avoid strict aliasing violations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Replace the cast+deref with memcpy() so that we don't upset
the compiler's strict aliasing rules.

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 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 45cb7cc7bd6c..18136c200458 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;
 
-- 
2.21.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux