Hi all,

I've been fixing and reverting this locally for the past month or so,
and I'm not sure if anyone else has seen this, but it looks like
there's some static analysis code that's been added to GCC 4.3.3 that
warns about code paths that could produce a call to `memset' with a
size parameter of zero, and which causes the build of `master' to
fail. The exact text of the warning is:

  /usr/include/bits/string3.h:82: warning: memset used with constant
zero length parameter; this could be due to transposed parameters

Find attached a tiny patch that adds a check on the size parameter in
`scm_gc_calloc', which seems to satisfy the compiler.


Regards,
Julian
From 92ce32eeac2600704fc643ea5f65bda92b2d3bd9 Mon Sep 17 00:00:00 2001
From: Julian Graham <julian.gra...@aya.yale.edu>
Date: Sun, 25 Oct 2009 13:00:08 -0400
Subject: [PATCH] Resolve warning in gcc-4.3 about transposed parameters passed to memset

* libguile/gc-malloc.c (scm_gc_calloc): Add explicit check on size parameter
---
 libguile/gc-malloc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index a96a186..0e60eba 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -206,7 +206,8 @@ void *
 scm_gc_calloc (size_t size, const char *what)
 {
   void *ptr = scm_gc_malloc (size, what);
-  memset (ptr, 0x0, size);
+  if (size)
+    memset (ptr, 0x0, size);
   return ptr;
 }
 
-- 
1.6.0.4

Reply via email to