public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7708: g++ -O inserts definition of std::string::replace in  library module
@ 2002-12-22 20:46 Bradford Castalia
  0 siblings, 0 replies; 4+ messages in thread
From: Bradford Castalia @ 2002-12-22 20:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/7708; it has been noted by GNATS.

From: Bradford Castalia <Castalia@azstarnet.com>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7708: g++ -O inserts definition of std::string::replace in 
 library module
Date: Sun, 22 Dec 2002 21:41:19 -0700

 When I get gcc3.2.1 (or greater) installed on the FreeBSD workstation
 (hasn't happened yet, sorry) I will definately run the test files
 again. You will probably get a faster response from one of the FreeBSD
 developers (http://www.FreeBSD.org).
 
 -- 
 
 Bradford Castalia
 
 bangerth@dealii.org wrote:
 > 
 > Synopsis: g++ -O inserts definition of std::string::replace in library module
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: bangerth
 > State-Changed-When: Thu Dec 19 18:19:52 2002
 > State-Changed-Why:
 >     I tried your program with gcc3.2, but on x86 linux. I can
 >     confirm that the mentioned symbols are present in the
 >     object file. However, they are weak:
 >     00000000 W std::string& std::string::_M_replace<....
 > 
 >     Weak symbols means: they can be in multiple object files,
 >     and one of these copies is picked at link time.
 > 
 >     Could you possibly check whether the problem still exists
 >     on your platform with gcc3.2.1?
 > 
 >     Thanks
 >       Wolfgang
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7708


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7708: g++ -O inserts definition of std::string::replace in  library module
@ 2003-01-14  0:46 Bradford Castalia
  0 siblings, 0 replies; 4+ messages in thread
From: Bradford Castalia @ 2003-01-14  0:46 UTC (permalink / raw)
  To: ljrittle; +Cc: gcc-prs

The following reply was made to PR c++/7708; it has been noted by GNATS.

From: Bradford Castalia <Castalia@azstarnet.com>
To: bangerth@dealii.org, Castalia@azstarnet.com, gcc-bugs@gcc.gnu.org,
   gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/7708: g++ -O inserts definition of std::string::replace in 
 library module
Date: Mon, 13 Jan 2003 17:36:47 -0700

 I've just installed the gcc32 package from the FreePSG ports site:
 
 idaeim:castalia>> g++ --version
 g++ (GCC) 3.2.1
 
 After running the test cases, as well as the full recompile of my project code,
 I can confirm that the -O switch no longer generates library symbol definitions
 for the std::string::replace method.
 
 Using a Test.h file:
 
 #include        <string>
 
 class Test
 {
 public:
 Test (const std::string& message = "");
 void message (const std::string& message);
 
 private:
 std::string Message;
 };
 
 And a Test.cpp file:
 
 #include        "Test.h"
 
 Test::Test (const std::string& message) : Message (message)
 {
 if (! Message.empty () && Message[Message.size () - 1] == '\n')
         Message.erase (Message.size () - 1);
 }
 
 void Test::message (const std::string& new_message)
 {
 Message.replace (std::string::size_type(0), Message.length (), new_message);
 if (! Message.empty () && Message[Message.size () - 1] == '\n')
         Message.erase (Message.size () - 1);
 }
 
 Building an object module compiled with g++ 3.1.1 20020617 (prerelease) [FreeBSD]
 (g++31 -O -c -o opt-Test.o Test.cpp) and then examing the object symbols reveals,
 in addition to the weak symbols, a text symbol for "replace":
 
 idaeim:castalia>> nm -g -o -C opt-Test.o | grep replace
 opt-Test.o:00000000 W std::string& std::string::_M_replace<char const*>(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, char const*, char const*, std::input_iterator_tag)
 opt-Test.o:00000000 W std::string& std::string::_M_replace_safe<__gnu_cxx::__normal_iterator<char*, std::string> >(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>)
 opt-Test.o:00000000 W std::string& std::string::_M_replace_safe<char const*>(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, char const*, char const*)
 opt-Test.o:000001f0 T std::string::replace(unsigned, unsigned, char const*, unsigned)
 
 Building an object module compiled with g++ 3.2.1 and then examing the symbols
 reveals that the text symbol is now an undefined reference to "replace" as expected:
 
 idaeim:castalia>> nm -g -o -C new-opt-Test.o | grep replace
 new-opt-Test.o:00000000 W std::string& std::string::_M_replace<char const*>(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, char const*, char const*, std::input_iterator_tag)
 new-opt-Test.o:00000000 W std::string& std::string::_M_replace_safe<__gnu_cxx::__normal_iterator<char*, std::string> >(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>)
 new-opt-Test.o:00000000 W std::string& std::string::_M_replace_safe<char const*>(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, char const*, char const*)
 new-opt-Test.o:         U std::string::replace(unsigned, unsigned, char const*, unsigned)
 
 The problem of problem of multiple definitions at link time has now been fixed.
 
 Thnx!
 
 -- 
 
 Bradford Castalia
 Systems Analyst
 
 
 bangerth@dealii.org wrote:
 > 
 > Synopsis: g++ -O inserts definition of std::string::replace in library module
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: bangerth
 > State-Changed-When: Thu Dec 19 18:19:52 2002
 > State-Changed-Why:
 >     I tried your program with gcc3.2, but on x86 linux. I can
 >     confirm that the mentioned symbols are present in the
 >     object file. However, they are weak:
 >     00000000 W std::string& std::string::_M_replace<....
 > 
 >     Weak symbols means: they can be in multiple object files,
 >     and one of these copies is picked at link time.
 > 
 >     Could you possibly check whether the problem still exists
 >     on your platform with gcc3.2.1?
 > 
 >     Thanks
 >       Wolfgang
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7708
 
 Wolfgang Bangerth wrote:
 > 
 > On Sun, 22 Dec 2002, Bradford Castalia wrote:
 > 
 > > When I get gcc3.2.1 (or greater) installed on the FreeBSD workstation
 > > (hasn't happened yet, sorry) I will definately run the test files
 > > again. You will probably get a faster response from one of the FreeBSD
 > > developers (http://www.FreeBSD.org).
 > 
 > Please let us know about your results. Maybe someone of the FeeBSD
 > maintainers could also try to look into this?
 > 
 > Regards
 >   Wolfgang
 > 
 > -------------------------------------------------------------------------
 > Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
 >                                www: http://www.ticam.utexas.edu/~bangerth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7708: g++ -O inserts definition of std::string::replace in library module
@ 2003-01-14  0:46 Wolfgang Bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2003-01-14  0:46 UTC (permalink / raw)
  To: ljrittle; +Cc: gcc-prs

The following reply was made to PR c++/7708; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Bradford Castalia <Castalia@azstarnet.com>
Cc: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/7708: g++ -O inserts definition of std::string::replace in
  library module
Date: Mon, 13 Jan 2003 18:44:34 -0600 (CST)

 > I've just installed the gcc32 package from the FreePSG ports site:
 > [...] 
 > The problem of problem of multiple definitions at link time has now been fixed.
 
 OK, that settles the matter for good.
 
 Thanks for your help!
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7708: g++ -O inserts definition of std::string::replace in library module
@ 2002-12-19 18:19 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2002-12-19 18:19 UTC (permalink / raw)
  To: Castalia, gcc-bugs, gcc-prs, nobody

Synopsis: g++ -O inserts definition of std::string::replace in library module

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Thu Dec 19 18:19:52 2002
State-Changed-Why:
    I tried your program with gcc3.2, but on x86 linux. I can 
    confirm that the mentioned symbols are present in the 
    object file. However, they are weak:
    00000000 W std::string& std::string::_M_replace<....
    
    Weak symbols means: they can be in multiple object files,
    and one of these copies is picked at link time.
    
    Could you possibly check whether the problem still exists
    on your platform with gcc3.2.1?
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7708


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-01-14  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-22 20:46 c++/7708: g++ -O inserts definition of std::string::replace in library module Bradford Castalia
  -- strict thread matches above, loose matches on Subject: below --
2003-01-14  0:46 Wolfgang Bangerth
2003-01-14  0:46 Bradford Castalia
2002-12-19 18:19 bangerth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).