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

[PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Jul 10, 2009, 17:10 UTC
Message-ID
<39niBtmtFs5Sy_fjtaztVmZBc5gMLjrIQhevVkHr5EAuPYiuRd5i__yABkFEZOZNG-W8HrgSclE@cipher.nrlssc.navy.mil>
In-Reply-To
<39niBtmtFs5Sy_fjtaztVh4dAZGS3bCbUWv-xJglfvb9KPJ_qQhUB4GiCpcoxguAgbDPS36AjnI@cipher.nrlssc.navy.mil>
The c99 MIPSpro Compiler version 7.4.4m on IRIX 6.5 does not properly
initialize run-time initialized arrays.  An array which is initialized with
fewer elements than the length of the array should have the unitialized
elements initialized to zero.  This compiler only initializes the remaining
elements when the last element is a static parameter.  So work around it
by adding a "NULL" initialization parameter.
---
 unpack-trees.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 05d0bb1..7894c07 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -128,7 +128,7 @@ static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_o
 
 static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o)
 {
-	struct cache_entry *src[5] = { ce, };
+	struct cache_entry *src[5] = { ce, NULL, };
 
 	o->pos++;
 	if (ce_stage(ce)) {
-- 
1.6.4.rc0.5.g76f7cf
Previous: Brandon CaseyNext: Brandon Casey
Message 2 of 8 in “How I compile on IRIX 6.5 with the MIPSpro compiler and ksh”
  1. 0/5 How I compile on IRIX 6.5 with the MIPSpro compiler and kshBrandon Casey, Jul 10, 2009
  2. 1/5 unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5Brandon Casey, Jul 10, 2009
  3. 2/5 git-compat-util.h: adjust for SGI IRIX 6.5Brandon Casey, Jul 10, 2009
  4. 3/5 Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile argumentsBrandon Casey, Jul 10, 2009
  5. 4/5 Makefile: add section for SGI IRIX 6.5Brandon Casey, Jul 10, 2009
  6. 5/5 test-lib.sh: work around ksh's trap shortcomingsBrandon Casey, Jul 10, 2009
  7. 6/5 Makefile: update IRIX64 sectionBrandon Casey, Jul 10, 2009
  8. Junio C HamanoJul 11, 2009

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.