public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/32284]  New: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults
@ 2007-06-11 14:22 bkoz at gcc dot gnu dot org
  2007-06-11 14:23 ` [Bug libstdc++/32284] " bkoz at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-06-11 14:22 UTC (permalink / raw)
  To: gcc-bugs

This is a regression post 3.4.6. 

gcc-4.1.x, gcc-4.2.x, gcc-4.3.x all have it. 

ie: 

// $ c++ -O -D_GLIBCXX_FULLY_DYNAMIC_STRING str.cc -o str
#include <string>

int main()
{
  std::string abc;  
  return 0;
}


gives:

*** glibc detected *** ./a.out: free(): invalid pointer: 0xb7f3c678 ***
======= Backtrace: =========
/lib/libc.so.6[0x4a92f9ad]
/lib/libc.so.6(cfree+0x90)[0x4a933000]
/mnt/share/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6(_ZdlPv+0x21)[0xb7f0c2e1]
/mnt/share/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0xb7eea51d]
./a.out(__gxx_personality_v0+0x18d)[0x80486d9]
/lib/libc.so.6(__libc_start_main+0xdc)[0x4a8dedec]
./a.out(__gxx_personality_v0+0x65)[0x80485b1]
======= Memory map: ========
08048000-08049000 r-xp 00000000 fd:00 59605146   /home/bkoz/a.out
08049000-0804a000 rw-p 00000000 fd:00 59605146   /home/bkoz/a.out
0804a000-0806b000 rw-p 0804a000 00:00 0          [heap]
4a8ac000-4a8c5000 r-xp 00000000 fd:00 33917325   /lib/ld-2.5.so
4a8c5000-4a8c6000 r--p 00018000 fd:00 33917325   /lib/ld-2.5.so
4a8c6000-4a8c7000 rw-p 00019000 fd:00 33917325   /lib/ld-2.5.so
4a8c9000-4aa02000 r-xp 00000000 fd:00 33917354   /lib/libc-2.5.so
4aa02000-4aa04000 r--p 00139000 fd:00 33917354   /lib/libc-2.5.so
4aa04000-4aa05000 rw-p 0013b000 fd:00 33917354   /lib/libc-2.5.so
4aa05000-4aa08000 rw-p 4aa05000 00:00 0 
4aa0a000-4aa2f000 r-xp 00000000 fd:00 33917357   /lib/libm-2.5.so
4aa2f000-4aa30000 r--p 00024000 fd:00 33917357   /lib/libm-2.5.so
4aa30000-4aa31000 rw-p 00025000 fd:00 33917357   /lib/libm-2.5.so
b7e38000-b7e3a000 rw-p b7e38000 00:00 0 
b7e3a000-b7e44000 r-xp 00000000 fd:00 51258449  
/mnt/share/bld/gcc/gcc/libgcc_s.so.1
b7e44000-b7e45000 rw-p 00009000 fd:00 51258449  
/mnt/share/bld/gcc/gcc/libgcc_s.so.1
b7e5d000-b7f36000 r-xp 00000000 fd:00 5210259   
/mnt/share/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.9
b7f36000-b7f3a000 r--p 000d9000 fd:00 5210259   
/mnt/share/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.9
b7f3a000-b7f3b000 rw-p 000dd000 fd:00 5210259   
/mnt/share/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.9
b7f3b000-b7f42000 rw-p b7f3b000 00:00 0 
b7f42000-b7f43000 r-xp b7f42000 00:00 0          [vdso]
bfc74000-bfc8a000 rw-p bfc74000 00:00 0          [stack]
Abort


Fixing this is relatively easy, just forward-porting the changes to
std::string::_Rep::_M_destroy that were taken out.

See attached patch.


-- 
           Summary: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING
                    faults
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32284


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

* [Bug libstdc++/32284] empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults
  2007-06-11 14:22 [Bug libstdc++/32284] New: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults bkoz at gcc dot gnu dot org
@ 2007-06-11 14:23 ` bkoz at gcc dot gnu dot org
  2007-06-11 15:26 ` pcarlini at suse dot de
  2007-06-23 11:33 ` pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-06-11 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bkoz at gcc dot gnu dot org  2007-06-11 14:23 -------
Created an attachment (id=13679)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13679&action=view)
add checks for empty


Possible patch.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32284


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

* [Bug libstdc++/32284] empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults
  2007-06-11 14:22 [Bug libstdc++/32284] New: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults bkoz at gcc dot gnu dot org
  2007-06-11 14:23 ` [Bug libstdc++/32284] " bkoz at gcc dot gnu dot org
@ 2007-06-11 15:26 ` pcarlini at suse dot de
  2007-06-23 11:33 ` pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2007-06-11 15:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pcarlini at suse dot de  2007-06-11 15:25 -------
Hi Benjamin. If you ask me, this issue is INVALID: it is *not* supported
building the library normally and then passing -D_GLIBCXX_FULLY_DYNAMIC_STRING
on the command line, and never was! Simply because basic_string is exported,
used in exported bits of locale, you know what I mean... As usual in such cases
(e.g., changing locale model), the user has to configure with
--enable-fully-dynamic-string and rebuild. In fact, note that the macro in the
patch has the conditional wrapped in #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING,
code which at some point was supposed to make a difference only when a *normal*
string was involved (in fact it doesn't, and that's why I removed it, the check
is redundant): the fact that adding back that code avoids the segmentation
fault is only because, by chance, this particular combination of exported
normal string + inline fully dynamic string works apparently better, but nobody
knows what would happen in other much more complex situations... That said, if
you really feel strongly about adding back that conditional, it's up to you,
but I would suggest at least adding a clear comment, summarizing the above.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32284


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

* [Bug libstdc++/32284] empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults
  2007-06-11 14:22 [Bug libstdc++/32284] New: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults bkoz at gcc dot gnu dot org
  2007-06-11 14:23 ` [Bug libstdc++/32284] " bkoz at gcc dot gnu dot org
  2007-06-11 15:26 ` pcarlini at suse dot de
@ 2007-06-23 11:33 ` pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2007-06-23 11:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-06-23 11:32 -------
Ok, let's close it...


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32284


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

end of thread, other threads:[~2007-06-23 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-11 14:22 [Bug libstdc++/32284] New: empty std::string w/ _GLIBCXX_FULLY_DYNAMIC_STRING faults bkoz at gcc dot gnu dot org
2007-06-11 14:23 ` [Bug libstdc++/32284] " bkoz at gcc dot gnu dot org
2007-06-11 15:26 ` pcarlini at suse dot de
2007-06-23 11:33 ` pcarlini at suse dot de

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