git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Dec 11, 2012, 20:34 UTC
Message-ID
<50C798EB.5030408@gmail.com>
On MinGW, GCC 4.7.2 complains about
    operation on 'p->m[end]' may be undefined
Fix this by replacing the faulty lines with those of 69825ca from
    https://github.com/ned14/nedmalloc/blob/master/nedmalloc.c
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 compat/nedmalloc/nedmalloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c
index d9a17a8..91c4e7f 100644
--- a/compat/nedmalloc/nedmalloc.c
+++ b/compat/nedmalloc/nedmalloc.c
@@ -603,7 +603,10 @@ static NOINLINE mstate FindMSpace(nedpool *p, threadcache *tc, int *lastUsed, si
 		}
 		/* We really want to make sure this goes into memory now but we
 		have to be careful of breaking aliasing rules, so write it twice */
-		*((volatile struct malloc_state **) &p->m[end])=p->m[end]=temp;
+		{
+			volatile struct malloc_state **_m=(volatile struct malloc_state **) &p->m[end];
+			*_m=(p->m[end]=temp);
+		}
 		ACQUIRE_LOCK(&p->m[end]->mutex);
 		/*printf("Created mspace idx %d\n", end);*/
 		RELEASE_LOCK(&p->mutex);
-- 
1.8.0.msysgit.1
Message 1 of 1 in “nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2”
  1. nedmalloc: Fix a compile warning (exposed as error) with GCC 4.7.2Sebastian Schuberth, Dec 11, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.