mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 08:10:11 +01:00
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.
This commit is contained in:
parent
3ff3d59ed9
commit
d4bb19e2c4
1 changed files with 3 additions and 2 deletions
|
|
@ -86,7 +86,8 @@ static void
|
||||||
compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
|
compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
|
||||||
{
|
{
|
||||||
FILE *out = NULL;
|
FILE *out = NULL;
|
||||||
void *ptr, *ref_ptr, *batch_ptr;
|
char *ptr;
|
||||||
|
void *ref_ptr, *batch_ptr;
|
||||||
#if HAVE_OPEN_MEMSTREAM
|
#if HAVE_OPEN_MEMSTREAM
|
||||||
size_t size;
|
size_t size;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -106,7 +107,7 @@ compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
|
||||||
* inside of an automake project's test infrastructure.
|
* inside of an automake project's test infrastructure.
|
||||||
*/
|
*/
|
||||||
#if HAVE_OPEN_MEMSTREAM
|
#if HAVE_OPEN_MEMSTREAM
|
||||||
out = open_memstream((char **)&ptr, &size);
|
out = open_memstream(&ptr, &size);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "platform lacks open_memstream, skipping.\n");
|
fprintf(stderr, "platform lacks open_memstream, skipping.\n");
|
||||||
exit(77);
|
exit(77);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue