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

Re: [PATCH 1/2] fast-import: Fix an gcc -Wuninitialized warning

From
Jeff King <peff@peff.net>
Date
Mar 26, 2013, 19:28 UTC
Message-ID
<20130326192822.GA28244@sigill.intra.peff.net>
In-Reply-To
<5151F278.2040109@ramsay1.demon.co.uk>
On Tue, Mar 26, 2013 at 07:09:44PM +0000, Ramsay Jones wrote:
Show 14 quoted lines
> Commit cbfd5e1c ("drop some obsolete "x = x" compiler warning hacks",
> 21-03-2013) removed a gcc hack that suppressed an "might be used
> uninitialized" warning issued by older versions of gcc.
> 
> However, commit 3aa99df8 ('fast-import: clarify "inline" logic in
> file_change_m', 21-03-2013) addresses an (almost) identical issue
> (with very similar code), but includes additional code in it's
> resolution. The solution used by this commit, unlike that used by
> commit cbfd5e1c, also suppresses the -Wuninitialized warning on
> older versions of gcc.
> 
> In order to suppress the warning (against the 'oe' symbol) in the
> note_change_n() function, we adopt the same solution used by commit
> 3aa99df8.

Yeah, they are essentially the same piece of code, so I don't mind this change. It is odd to me that gcc gets it right in one case but not the other, but I think we are deep into the vagaries of the compiler's code flow analysis here, and we cannot make too many assumptions.

Were you actually triggering this warning, and if so, on what version of gcc? Or did the asymmetry just offend your sensibilities?

-Peff
Previous: Ramsay JonesNext: Ramsay Jones
Message 2 of 4 in “fast-import: Fix an gcc -Wuninitialized warning”
  1. 1/2 fast-import: Fix an gcc -Wuninitialized warningRamsay Jones, Mar 26, 2013
  2. Jeff KingMar 26, 2013
  3. Ramsay JonesMar 28, 2013
  4. Jeff KingMar 28, 2013

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.