summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2022-08-22 21:36:52 -0400
committerMatt Turner <mattst88@gmail.com>2022-08-23 22:54:15 +0000
commitd4bb19e2c49de32a01cef56ad739cc10e9afd237 (patch)
treea9c50d431e5bf0519247a472cf3c6e68bdf9e589 /intel
parent3ff3d59ed96f71523e0aa52461b01a1b1168c5e0 (diff)
intel: Avoid aliasing violation
../intel/test_decode.c: In function ‘compare_batch’: ../intel/test_decode.c:109:39: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing] 109 | out = open_memstream((char **)&ptr, &size); | ^~~~ cc1: some warnings being treated as errors The fix is simple: just declare `ptr` as a `char *` to begin with.
Diffstat (limited to 'intel')
-rw-r--r--intel/test_decode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/intel/test_decode.c b/intel/test_decode.c
index b9f5b927..c47752c9 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -86,7 +86,8 @@ static void
compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
{
FILE *out = NULL;
- void *ptr, *ref_ptr, *batch_ptr;
+ char *ptr;
+ void *ref_ptr, *batch_ptr;
#if HAVE_OPEN_MEMSTREAM
size_t size;
#endif
@@ -106,7 +107,7 @@ compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
* inside of an automake project's test infrastructure.
*/
#if HAVE_OPEN_MEMSTREAM
- out = open_memstream((char **)&ptr, &size);
+ out = open_memstream(&ptr, &size);
#else
fprintf(stderr, "platform lacks open_memstream, skipping.\n");
exit(77);