Article View: gnu.g++.bug
Article #975Problem with const on hp730 in gcc-2.2.2
From: John David Anglin
Date: Tue, 15 Sep 1992 13:08
Date: Tue, 15 Sep 1992 13:08
32 lines
1260 bytes
1260 bytes
When I try to build groff-1.6 under hpux 8.07 on an hp730 using gcc-2.2.2,
ld doesn't find the symbol "NULL_SYMBOL" when linking troff. I have tried to
reduce the problem to the simplest possible form. When I compile the routine
main with gcc -c and nm main.o|grep NULL, it gives the following output:
NULL_SYMBOL | |undef |code |
Why is NULL_SYMBOL in the code segment? If I remove "const" from
the line in symbol.h, then NULL_SYMBOL switches to the data segment. What
gives?
// symbol.h
class symbol {
const char *s;
};
extern const symbol NULL_SYMBOL;
// main.cc
// Short main program to exhibit problem with const.
#include "symbol.h"
main()
{
symbol s = NULL_SYMBOL;
}
Dave Anglin
National Research Council of Canada
Technical Details
Message-ID:
<9209152106.AA10640@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hiauly1.hia.nrc.ca!daveShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hiauly1.hia.nrc.ca!dave From: dave@hiauly1.hia.nrc.ca (John David Anglin) Subject: Problem with const on hp730 in gcc-2.2.2 Message-ID: <9209152106.AA10640@life.ai.mit.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 15 Sep 1992 13:08:05 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 33