[Mesa-dev] [PATCH 2/2] mesa: fix some strict-aliasing issues with int64

Timothy Arceri tarceri at itsqueeze.com
Wed Feb 8 01:35:21 UTC 2017


---
 src/mesa/main/uniform_query.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 9da53a7..98711df 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -562,12 +562,18 @@ log_uniform(const void *values, enum glsl_base_type basicType,
       case GLSL_TYPE_INT:
 	 printf("%d ", v[i].i);
 	 break;
-      case GLSL_TYPE_UINT64:
-         printf("%" PRIu64 " ", *(uint64_t* )&v[i * 2].u);
+      case GLSL_TYPE_UINT64: {
+         uint64_t tmp;
+         memcpy(&tmp, &v[i * 2].u, sizeof(tmp));
+         printf("%" PRIu64 " ", tmp);
          break;
-      case GLSL_TYPE_INT64:
-         printf("%" PRId64 " ", *(int64_t* )&v[i * 2].u);
+      }
+      case GLSL_TYPE_INT64: {
+         int64_t tmp;
+         memcpy(&tmp, &v[i * 2].u, sizeof(tmp));
+         printf("%" PRId64 " ", tmp);
          break;
+      }
       case GLSL_TYPE_FLOAT:
 	 printf("%g ", v[i].f);
 	 break;
-- 
2.9.3



More information about the mesa-dev mailing list