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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:11

Robert Schiele [off-list ref] writes:
Commit 5b8e6f85 introduced stubs for three functions that make no sense
for git-shell.  But those stubs defined libgit.a functions a second time
so that a linker can complain.  While commit 78568448 fixes this problem
it introduces a new issue on the affected systems: Some versions of the
Sun compiler generate references to global variables when they see
extern declarations for those, even when they are never used in the
code.
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.

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

From: Robert Schiele <hidden>
Date: 2016-06-15 22:45:11

On Mon, Aug 18, 2008 at 05:29:11PM -0700, Junio C Hamano wrote:
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."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help