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

Re: [PATCH] Avoid gcc compiler warning

From
Jeff King <peff@peff.net>
Date
Dec 9, 2014, 08:47 UTC
Message-ID
<20141209084728.GA13123@peff.net>
In-Reply-To
<b9e1cb1f858e71b964be4f752fcebc22cd944ebc.1418056722.git.johannes.schindelin@gmx.de>
On Mon, Dec 08, 2014 at 05:38:59PM +0100, Johannes Schindelin wrote:
Show 8 quoted lines
> At least on this developer's MacOSX (Snow Leopard, gcc-4.2.1), GCC prints
> a warning that 'hash' may be used uninitialized when compiling
> test-hashmap that 'hash' may be used uninitialized (but GCC 4.6.3 on this
> developer's Ubuntu server does not report this problem).
> 
> Since hash() is called from perf_hashmap() which accepts an unchecked
> integer value from the command line, the warning appears to be legitimate,
> even if the test-hashmap command is only called from the test suite.

I think the older gcc is wrong; we are switching on "method & 3", which must be in the range 0-3 (and we cover all cases).

I do not mind silencing the warning anyway, but see this discussion:
  http://thread.gmane.org/gmane.comp.version-control.git/258186
The thread seems very broken in gmane, but it continues here:
  http://article.gmane.org/gmane.comp.version-control.git/258232
  http://thread.gmane.org/gmane.comp.version-control.git/258245
  http://article.gmane.org/gmane.comp.version-control.git/258264
-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 3 in “Avoid gcc compiler warning”
  1. Avoid gcc compiler warningJohannes Schindelin, Dec 8, 2014
  2. Jeff KingDec 9, 2014
  3. Johannes SchindelinDec 9, 2014

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.