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

Re: [PATCH] add definitions for global variables to shell.c

From
Robert Schiele <rschiele@gmail.com>
Date
Aug 19, 2008, 07:26 UTC
Message-ID
<20080819072650.GE11842@schiele.dyndns.org>
In-Reply-To
<7vy72tkfu0.fsf@gitster.siamese.dyndns.org>
On Mon, Aug 18, 2008 at 05:29:11PM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> Haven't looked at the real declarations but if the decl are "extern" and
> nobody refers to them, why should the resulting object file require them
> to be defined anywhere?  If the decl are not and in (fortran-ish) "common"
> section, on the other hand, you shouldn't have to define them yourself
> like this either.
> 
> This sounds like a compiler bug to me.

This was my first thought as well but after more inspection there are two things to consider:

1. I was not really precise enough in my description since I didn't spot that
   when I looked into the issue first: Actually there are references to these
   variables in static inline functions in cache.h.  Thus there actually is a
   reference though one that will never be used since abspath.c (that includes
   cache.h) is not calling any of these functions.
2. Since these symbols turn out to be referenced though in dead code only I
   wouldn't call it a compiler bug.  Obviously a smart compiler would do dead
   code elimination here but the fact that this compiler is not doing so is
   bad but not really a bug.
Robert
-- 
Robert Schiele
Dipl.-Wirtsch.informatiker	mailto:rschiele@gmail.com

"Quidquid latine dictum sit, altum sonatur."
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 13 in “add definitions for global variables to shell.c”
  1. add definitions for global variables to shell.cRobert Schiele, Aug 18, 2008
  2. Junio C HamanoAug 19, 2008
  3. Robert SchieleAug 19, 2008
  4. Junio C HamanoAug 19, 2008
  5. Robert SchieleAug 19, 2008
  6. Johannes SixtAug 19, 2008
  7. Robert SchieleAug 19, 2008
  8. Junio C HamanoAug 19, 2008
  9. 1/2 shell: do not play duplicated definition games to shrink the executableJunio C Hamano, Aug 20, 2008
  10. 2/2 Build-in "git-shell"Junio C Hamano, Aug 20, 2008
  11. Johannes SixtAug 20, 2008
  12. Junio C HamanoAug 20, 2008
  13. Robert SchieleAug 20, 2008

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.