This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53838] New: _GLIBCXX_DEBUG and empty ostringstream
- From: "akim.demaille at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jul 2012 11:31:56 +0000
- Subject: [Bug libstdc++/53838] New: _GLIBCXX_DEBUG and empty ostringstream
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53838
Bug #: 53838
Summary: _GLIBCXX_DEBUG and empty ostringstream
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: akim.demaille@gmail.com
Hi,
The following program fails on Mac OS X with both 4.7 and 4.8.
$ uname -a
Darwin erebus.lrde.epita.fr 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9
19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
$ g++-mp-4.7 --version
g++-mp-4.7 (MacPorts gcc47 4.7.1_1) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-mp-4.8 --version
g++-mp-4.8 (MacPorts gcc48 4.8-20120701_0) 4.8.0 20120701 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat simpleaut.cc
# define _GLIBCXX_DEBUG 1
# include <sstream>
int main()
{
std::ostringstream s;
s.str();
}
$ g++-mp-4.8 tests/unit/simpleaut.cc
$ ./a.out
a.out(28056) malloc: *** error for object 0x10a5f2340: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug
zsh: abort ./a.out
(gdb) bt
#0 0x00007fff89bf582a in __kill ()
#1 0x00007fff89833a9c in abort ()
#2 0x00007fff8989284c in free ()
#3 0x0000000100000b86 in __gnu_cxx::new_allocator<char>::deallocate
(this=0x7fff5fbff847,
__p=0x1000d0340 "") at ext/new_allocator.h:102
#4 0x0000000100000b58 in std::string::_Rep::_M_destroy (this=0x1000d0340,
__a=@0x7fff5fbff89f) at bits/basic_string.tcc:451
#5 0x0000000100000ae6 in std::string::_Rep::_M_dispose (this=0x1000d0340,
__a=@0x7fff5fbff89f) at bits/basic_string.h:251
#6 0x00000001000009fd in std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string (this=0x7fff5fbffa20) at
bits/basic_string.h:541
#7 0x0000000100000968 in main () at tests/unit/simpleaut.cc:7