[MacPorts] #35070: _GLIBCXX_DEBUG and empty ostringstream
MacPorts
noreply at macports.org
Tue Jul 3 08:28:42 PDT 2012
#35070: _GLIBCXX_DEBUG and empty ostringstream
-------------------------------------+--------------------------------------
Reporter: akim.demaille@… | Owner: macports-tickets@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.1.1
Keywords: | Port: gcc47
-------------------------------------+--------------------------------------
Hi,
The following program fails on Mac OS X with both 4.7 and 4.8.
{{{
$ uname -a
Darwin padam.local 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_0) 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.7 tests/unit/simpleaut.cc
Using built-in specs.
COLLECT_GCC=g++-mp-4.7
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin11/4.7.1
/lto-wrapper
Target: x86_64-apple-darwin11
Configured with: ../gcc-4.7.1/configure --prefix=/opt/local --build=x86_64
-apple-darwin11 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
--libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local
--with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-
suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-
ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl
--enable-stage1-checking --disable-multilib --enable-lto --with-
as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-
ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc47 4.7.1_0'
Thread model: posix
gcc version 4.7.1 (MacPorts gcc47 4.7.1_0)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.4' '-v' '-shared-libgcc'
'-mtune=core2'
/opt/local/libexec/gcc/x86_64-apple-darwin11/4.7.1/cc1plus -quiet -v
-D__DYNAMIC__ foo.cc -fPIC -quiet -dumpbase foo.cc -mmacosx-version-
min=10.7.4 -mtune=core2 -auxbase foo -version -o
/var/folders/vc/vkjp1hhs5dgg8blcpzm6t59c0000gp/T//ccDjHKgh.s
GNU C++ (MacPorts gcc47 4.7.1_0) version 4.7.1 (x86_64-apple-darwin11)
compiled by GNU C version 4.7.1, GMP version 5.0.4, MPFR version
3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/opt/local/lib/gcc47/gcc/x86_64-apple-
darwin11/4.7.1/../../../../../x86_64-apple-darwin11/include"
ignoring duplicate directory "/opt/local/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/opt/local/include/gcc47/c++/
/opt/local/include/gcc47/c++//x86_64-apple-darwin11
/opt/local/include/gcc47/c++//backward
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1/include
/opt/local/include
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks
End of search list.
GNU C++ (MacPorts gcc47 4.7.1_0) version 4.7.1 (x86_64-apple-darwin11)
compiled by GNU C version 4.7.1, GMP version 5.0.4, MPFR version
3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 09950ee4f031f09244f876c6af55ed8f
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.4' '-v' '-shared-libgcc'
'-mtune=core2'
/opt/local/bin/as -v -arch x86_64 -force_cpusubtype_ALL -o
/var/folders/vc/vkjp1hhs5dgg8blcpzm6t59c0000gp/T//cc5KozFj.o
/var/folders/vc/vkjp1hhs5dgg8blcpzm6t59c0000gp/T//ccDjHKgh.s
Apple Inc version cctools-822, GNU assembler version 1.38
COMPILER_PATH=/opt/local/libexec/gcc/x86_64-apple-
darwin11/4.7.1/:/opt/local/libexec/gcc/x86_64-apple-
darwin11/4.7.1/:/opt/local/libexec/gcc/x86_64-apple-
darwin11/:/opt/local/lib/gcc47/gcc/x86_64-apple-
darwin11/4.7.1/:/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/
LIBRARY_PATH=/opt/local/lib/:/opt/local/lib/gcc47/gcc/x86_64-apple-
darwin11/4.7.1/:/opt/local/lib/gcc47/gcc/x86_64-apple-
darwin11/4.7.1/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.7.4' '-v' '-shared-libgcc'
'-mtune=core2'
/opt/local/libexec/gcc/x86_64-apple-darwin11/4.7.1/collect2 -dynamic
-arch x86_64 -macosx_version_min 10.7.4 -weak_reference_mismatches non-
weak -o a.out -lcrt1.10.6.o -L/opt/local/lib
-L/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1
-L/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1/../../..
/var/folders/vc/vkjp1hhs5dgg8blcpzm6t59c0000gp/T//cc5KozFj.o -lstdc++
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
collect2 version 4.7.1
/opt/local/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.7.4
-weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o
-L/opt/local/lib -L/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1
-L/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1/../../..
/var/folders/vc/vkjp1hhs5dgg8blcpzm6t59c0000gp/T//cc5KozFj.o -lstdc++
-no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld PROJECT:ld64-128.2
Library search paths:
/opt/local/lib
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.1
/opt/local/lib/gcc47
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
$ ./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
}}}
Please, see the (wrong) bug report I made to the GCC team, where they emit
ideas about the possible problem:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53838
--
Ticket URL: <https://trac.macports.org/ticket/35070>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list