From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kiril Vidimce < To: nobody@gcc Cc: gcc-prs@gcc.gnu. Subject: Re: c/2397: big char array causes segfault Date: Mon, 26 Mar 2001 20:16:00 -0000 Message-id: <20010327041601.7516.qmail@sourceware.cygnus.com> X-SW-Source: 2001-03/msg00286.html List-Id: The following reply was made to PR c/2397; it >>From snyder@fnal.gov Mon Mar 26 21:46:00 2001 From: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org Subject: c++/2398: external name gets put in wrong namespace Date: Mon, 26 Mar 2001 21:46:00 -0000 Message-id: <200103270538.f2R5ctu30354@karma.fnal.gov> X-SW-Source: 2001-03/msg00287.html Content-length: 2519 >Number: 2398 >Category: c++ >Synopsis: external name gets put in wrong namespace >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon Mar 26 21:46:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: scott snyder >Release: 3.0 20010326 (prerelease) >Organization: >Environment: System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long >Description: If i compile the source below and look at the generated code, i see that the reference to the rcp::EntryRCPID constructor is said to be in the global namespace, _not_ the rcp namespace. If the typedef is removed, then the external reference moves back to the rcp namespace. Oddly, if the EntryRCPID class is made non-virtual by removing the destructor declaration, and if i turn on debugging, then the external name also moves back to the rcp namespace. >How-To-Repeat: --------------------------------------------------------------------- namespace rcp { struct EntryRCPID { EntryRCPID(); virtual ~EntryRCPID(); }; typedef EntryRCPID EntryRCPID; } void xyzzy() { rcp::EntryRCPID x; } --------------------------------------------------------------------- $ ./cc1plus -quiet x.cc $ c++filt < x.s | grep EntryRCPID call EntryRCPID::EntryRCPID() call EntryRCPID::~EntryRCPID() If i comment out the destructor declaration in the above and add -g to the compilation, i get instead the following results: $ ./cc1plus -g -quiet x.cc $ c++filt < x.s | grep EntryRCPID .stabs "EntryRCPID:T(0,25)=s1operator=::(0,26)=#(0,25),(0,27)=&(0,25),(0,28)=*(0,25),(0,29)=&(0,25),(0,21);:rcp::EntryRCPID::operator=(rcp::EntryRCPID const&);2A.;__base_ctor::(0,30)=#(0,25),(0,21),(0,28),(0,29),(0,21);:rcp::EntryRCPID::EntryRCPID(rcp::EntryRCPID const&);2A.;__comp_ctor::(0,30):rcp::EntryRCPID::EntryRCPID(rcp::EntryRCPID const&);2A.;__base_ctor::(0,31)=#(0,25),(0,21),(0,28),(0,21);:rcp::EntryRCPID::EntryRCPID();2A.;__comp_ctor::(0,31):rcp::EntryRCPID::EntryRCPID();2A.;;",128,0,0,0 .stabs "EntryRCPID:Tt(0,25)",128,0,4,0 call rcp::EntryRCPID::EntryRCPID() >Fix: >Release-Note: >Audit-Trail: >Unformatted: