Mesa (main): swrast: Fix a warning from gcc 11
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 16:40:05 UTC 2021
Module: Mesa
Branch: main
Commit: f535ab59e2611a3480534001d0161e04454262d7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f535ab59e2611a3480534001d0161e04454262d7
Author: Adam Jackson <ajax at redhat.com>
Date: Fri Jun 4 13:40:52 2021 -0400
swrast: Fix a warning from gcc 11
gcc 11 dixit:
In function ‘sample_2d_ewa’,
inlined from ‘sample_lambda_2d_aniso’ at ../src/mesa/swrast/s_texfilter.c:1995:10:
../src/mesa/swrast/s_texfilter.c:1729:13: warning: ‘sample_2d_nearest’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
1729 | sample_2d_nearest(ctx, samp, img, newCoord, rgba);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/mesa/swrast/s_texfilter.c: In function ‘sample_lambda_2d_aniso’:
../src/mesa/swrast/s_texfilter.c:1729:13: note: referencing argument 4 of type ‘const GLfloat *’ {aka ‘const float *’}
Indeed, newCoord is GLfloat[2] but the argument is typed GLfloat[4],
even though only the first two (s and t) are ever read. Fix the array
size in the function signature to reflect the maximum element actually
addressed.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11273>
---
src/mesa/swrast/s_texfilter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index e78f71ec9eb..9f863139637 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -1116,7 +1116,7 @@ static void
sample_2d_nearest(struct gl_context *ctx,
const struct gl_sampler_object *samp,
const struct gl_texture_image *img,
- const GLfloat texcoord[4],
+ const GLfloat texcoord[2],
GLfloat rgba[])
{
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
More information about the mesa-commit
mailing list