On 07/20/2012 04:45 PM, Chad Versace wrote:
Found by compiler warning:
     i830_texstate.c:131:28: warning: argument to 'sizeof' in 'memset' call
           is the same expression as the destination; did you mean to
           dereference it?  [-Wsizeof-pointer-memaccess]
        memset(state, 0, sizeof(state));
               ~~~~~            ^~~~~

Huh, I've never seen that one before. Is that something new in recent gcc? I like it.


On 64-bit systems, memset here would write an extra 4 bytes.

Candidate for 8.0 branch?


Signed-off-by: Chad Versace<chad.vers...@linux.intel.com>
---
  src/mesa/drivers/dri/i915/i830_texstate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c 
b/src/mesa/drivers/dri/i915/i830_texstate.c
index 5f32b92..b7d2d33 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -128,7 +128,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
     GLubyte border[4];
     GLuint dst_x, dst_y;

-   memset(state, 0, sizeof(state));
+   memset(state, 0, sizeof(*state));

     /*We need to refcount these. */


Reviewed-by: Brian Paul <bri...@vmware.com>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to