Path: utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!moose.cita.toronto.edu!trq
From: trq@moose.cita.toronto.edu (Tom Quinn)
Newsgroups: gnu.gcc.bug
Subject: bug in sparc gcc 1.28
Message-ID: <8809211615.AA23893@moose.cita.toronto.edu>
Date: 21 Sep 88 16:15:09 GMT
References: <8809211600.AA23883@moose.cita.toronto.edu>
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 50

The sparc assembler under SunOS 3.2-Sys4 and SunOS 4.0 turn the line:
.common _line,280,"bss"
into a global symbol, hence it can not be used to allocate bss space
for local symbols.  There is a directive ".reserve" which will
accomplish this.

Repeat by:
compile the file:
---------------------------------------------------
static char line[200 + 80], *eptr = line, *lptr = line;
---------------------------------------------------

nm file.o will give:
00000000 d _eptr
00000008 C _line
00000004 d _lptr
instead of:
00000000 d _eptr
00000008 b _line
00000004 d _lptr

My fix:

diff -c -r1.1 tm-sparc.h
*** /tmp/,RCSt1a09181   Wed Sep 21 12:21:18 1988
--- tm-sparc.h  Wed Sep 21 09:31:12 1988
***************
*** 1135,1141
     to define a local common symbol.  */
  
  #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
! ( fputs ("\n.common ", (FILE)),                       \
    assemble_name ((FILE), (NAME)),             \
    fprintf ((FILE), ",%d,\"bss\"\n", (ROUNDED)))
  

--- 1135,1141 -----
     to define a local common symbol.  */
  
  #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
! ( fputs ("\n.reserve ", (FILE)),                      \
    assemble_name ((FILE), (NAME)),             \
    fprintf ((FILE), ",%d,\"bss\"\n", (ROUNDED)))
  
Tom Quinn                 Canadian Institute for Theoretical Astrophysics
trq@moose.cita.toronto.edu
SOON TO BE trq@moose.cita.utoronto.ca
UUCP   - decvax!utgpu!moose!trq
BITNET - quinn@utorphys.bitnet
ARPA   - trq%moose.cita.toronto.edu@relay.cs.net