From: lordhavoc Date: Sat, 1 Jun 2002 21:04:36 +0000 (+0000) Subject: use volatile on icolor and fcolor pointers in GL_ConvertColorsFloatToByte to avoid... X-Git-Tag: RELEASE_0_2_0_RC1~488 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=97bb7ca0b61c8e2f1b81515f3b9f5b178134a709;p=xonotic%2Fdarkplaces.git 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 --- 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;