public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Undefined reference to std::string::_Rep::_S_empty_rep_storage when compiling with -O2.
@ 2004-02-03 15:55 llewelly
  2004-02-05 19:55 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: llewelly @ 2004-02-03 15:55 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 3938 bytes --]


GCC version: gcc version 3.4.0 20040128 (prerelease)
System type: i386-unknown-freebsd5.1
Configuration options: ../gcc-3.4-20040128/configure
    --disable-checking --disable-nls --enable-langauges=c,c++
    --prefix=/usr/local/gcc-3.4-20040128
    --program-suffix=-3.4-20040128
    --enable-threads --with-cpu=i686
    --enable-version-specific-runtime-libs
    --enable-libstdcxx-debug

Command line that triggers the bug: g++-3.4-20040128 -O2 string_bug.cc

Compiler output: 

    $ cat string_bug.cc
    #include <string>

    int main()
        {
            const std::string exclam= "!";
        }

    $ g++-3.4-20040128 -v -O2 --save-temps string_bug.cc
    Reading specs from /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/specs
    Configured with: ../gcc-3.4-20040128/configure --disable-checking --disable-nls --enable-langauges=c,c++ --prefix=/usr/local/gcc-3.4-20040128 --program-suffix=-3.4-20040128 --enable-threads --with-cpu=i686 --enable-version-specific-runtime-libs --enable-libstdcxx-debug
    Thread model: posix
    gcc version 3.4.0 20040128 (prerelease)
     /usr/local/gcc-3.4-20040128/libexec/gcc/i386-unknown-freebsd5.1/3.4.0/cc1plus -E -quiet -v string_bug.cc -mtune=i686 -O2 -o string_bug.ii
    ignoring nonexistent directory "/usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/../../../../i386-unknown-freebsd5.1/include"
    #include "..." search starts here:
    #include <...> search starts here:
     /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/include/c++
     /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/include/c++/i386-unknown-freebsd5.1
     /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/include/c++/backward
     /usr/local/include
     /usr/local/gcc-3.4-20040128/include
     /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/include
     /usr/include
    End of search list.
     /usr/local/gcc-3.4-20040128/libexec/gcc/i386-unknown-freebsd5.1/3.4.0/cc1plus -fpreprocessed string_bug.ii -quiet -dumpbase string_bug.cc -mtune=i686 -auxbase string_bug -O2 -version -o string_bug.s
    GNU C++ version 3.4.0 20040128 (prerelease) (i386-unknown-freebsd5.1)
            compiled by GNU C version 3.4.0 20040128 (prerelease).
    GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64713
     as -o string_bug.o string_bug.s
     /usr/local/gcc-3.4-20040128/libexec/gcc/i386-unknown-freebsd5.1/3.4.0/collect2 -V -dynamic-linker /usr/libexec/ld-elf.so.1 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/crtbegin.o -L/usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0 -L/usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/../../.. string_bug.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/gcc-3.4-20040128/lib/gcc/i386-unknown-freebsd5.1/3.4.0/crtend.o /usr/lib/crtn.o
    string_bug.o: In function `main':
    string_bug.o(.text+0x35): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage'
    GNU ld version 2.13.2 [FreeBSD] 2002-11-27
      Supported emulations:
       elf_i386_fbsd
    collect2: ld returned 1 exit status
    $

Here's the error line, repeated for clarity:

  undefined reference to
  `std::basic_string
    <
      char, std::char_traits<char>, std::allocator<char>
    >::_Rep::_S_empty_rep_storage'

The work-around for this bug is to compile with -fno-inline; that is:

    $ g++-3.4-20040128 -O2 -fno-inline string_bug.cc

    reports no errors.

Because of the #include<string>, I need to attach a large (362K, 38K
    bzip2'd) preprocessed file. I could not figure out how to do this
    in the bugzilla interface. The best think I could think of was to
    email this message to gcc-bugs, wait for it appear in the web
    archive, and put a link to it in the bugzilla report.


[-- Attachment #2: Preprocessor output, bzip2'd --]
[-- Type: application/octet-stream, Size: 38340 bytes --]

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

* Re: Undefined reference to std::string::_Rep::_S_empty_rep_storage when compiling with -O2.
  2004-02-03 15:55 Undefined reference to std::string::_Rep::_S_empty_rep_storage when compiling with -O2 llewelly
@ 2004-02-05 19:55 ` Jim Wilson
  2004-02-06  2:41   ` llewelly
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2004-02-05 19:55 UTC (permalink / raw)
  To: llewelly; +Cc: gcc-bugs

llewelly@lifesupport.shutdown.com wrote:
> Because of the #include<string>, I need to attach a large (362K, 38K
>     bzip2'd) preprocessed file. I could not figure out how to do this
>     in the bugzilla interface. The best think I could think of was to
>     email this message to gcc-bugs, wait for it appear in the web
>     archive, and put a link to it in the bugzilla report.

You can file a bug report, and then once it is in the bug database, you 
can add attachments to the bug report via the web interface.  This 
probably should be documented somewhere if it isn't already.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Re: Undefined reference to std::string::_Rep::_S_empty_rep_storage when compiling with -O2.
  2004-02-05 19:55 ` Jim Wilson
@ 2004-02-06  2:41   ` llewelly
  0 siblings, 0 replies; 3+ messages in thread
From: llewelly @ 2004-02-06  2:41 UTC (permalink / raw)
  To: Jim Wilson; +Cc: gcc-bugs

Jim Wilson <wilson@specifixinc.com> writes:

> llewelly@lifesupport.shutdown.com wrote:
> > Because of the #include<string>, I need to attach a large (362K, 38K
> >     bzip2'd) preprocessed file. I could not figure out how to do this
> >     in the bugzilla interface. The best think I could think of was to
> >     email this message to gcc-bugs, wait for it appear in the web
> >     archive, and put a link to it in the bugzilla report.
> 
> You can file a bug report,

I'm sorry - I guess I wasn't clear. I did file a bug report - 14001. A
    few days later it was marked as a duplicate of 12179, and Geof
    just posted a patch for it, which I haven't yet had time to try.

> and then once it is in the bug database,
> you can add attachments to the bug report via the web interface.  This
> probably should be documented somewhere if it isn't already.
[snip]

Thank you - I'll remember that next time.


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

end of thread, other threads:[~2004-02-06  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 15:55 Undefined reference to std::string::_Rep::_S_empty_rep_storage when compiling with -O2 llewelly
2004-02-05 19:55 ` Jim Wilson
2004-02-06  2:41   ` llewelly

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).