]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
use volatile on icolor and fcolor pointers in GL_ConvertColorsFloatToByte to avoid...
[xonotic/darkplaces.git] / gl_backend.c
index 385a3d7338f203a81d6720c246ede7e82a42f785..d25ca67dbd1b3a20033e809853ec2473df90e1ef 100644 (file)
@@ -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;