From 97bb7ca0b61c8e2f1b81515f3b9f5b178134a709 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sat, 1 Jun 2002 21:04:36 +0000 Subject: [PATCH] use volatile on icolor and fcolor pointers in GL_ConvertColorsFloatToByte to avoid aliasing problems (aliasing is exactly what that code is doing, after all) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1884 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index 385a3d73..d25ca67d 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -592,8 +592,12 @@ void GL_UpdateFarclip(void) void GL_ConvertColorsFloatToByte(void) { - int i, k, total, *icolor; - float *fcolor; + int i, k, total; + // LordHavoc: to avoid problems with aliasing (treating memory as two + // different types - exactly what this is doing), these must be volatile + // (or a union) + volatile int *icolor; + volatile float *fcolor; qbyte *bcolor; total = currentvertex * 4; -- 2.39.2