public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64504] New: Invalid free() with _GLIBCXX_DEBUG and -fwhole-program
@ 2015-01-05 19:46 andrey.vihrov at gmail dot com
  2015-01-06 11:18 ` [Bug libstdc++/64504] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: andrey.vihrov at gmail dot com @ 2015-01-05 19:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64504

            Bug ID: 64504
           Summary: Invalid free() with _GLIBCXX_DEBUG and -fwhole-program
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.vihrov at gmail dot com

Created attachment 34383
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34383&action=edit
Preprocessed source

Compiling the following program:

#define _GLIBCXX_DEBUG

#include <iostream>
#include <string>

int main()
{
    std::string s;
    std::cin >> s;
}

with "g++ -fwhole-program x.cpp" gives me

*** Error in `./a.out': free(): invalid pointer: 0x00000000006017c0 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x732ae)[0x7fb15966e2ae]
/usr/lib/libc.so.6(+0x7872e)[0x7fb15967372e]
/usr/lib/libc.so.6(+0x78eeb)[0x7fb159673eeb]
/usr/lib/libstdc++.so.6(_ZNSs7reserveEm+0xa4)[0x7fb159f7d3e4]
/usr/lib/libstdc++.so.6(_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RSbIS4_S5_T1_E+0x214)[0x7fb159f302f4]
./a.out[0x400b40]
/usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7fb15961b040]
./a.out[0x4009a9]

This is on 64-bit Arch Linux with GCC 4.9.2. My understanding of
-fwhole-program is that it can be used with one source file that includes
standard library headers and links with the standard library. If this is wrong,
then I'm sorry for filing a bogus bug report.

I have searched for similar reports and found bug #53838. And indeed the sample
program from that bug also crashes with the same message. However, my system
has only one GCC and libstdc++, unlike in that case.

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc-multilib/src/gcc-4.9-20141224/configure
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 4.9.2 20141224 (prerelease) (GCC)


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

end of thread, other threads:[~2015-06-09 16:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 19:46 [Bug libstdc++/64504] New: Invalid free() with _GLIBCXX_DEBUG and -fwhole-program andrey.vihrov at gmail dot com
2015-01-06 11:18 ` [Bug libstdc++/64504] " redi at gcc dot gnu.org
2015-01-06 14:08 ` andrey.vihrov at gmail dot com
2015-01-25 18:35 ` andrey.vihrov at gmail dot com
2015-01-26 10:56 ` rguenth at gcc dot gnu.org
2015-01-26 11:06 ` redi at gcc dot gnu.org
2015-06-09 15:12 ` andrey.vihrov at gmail dot com
2015-06-09 16:56 ` redi at gcc dot gnu.org

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