public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34104] New: auto_ptr error catching
@ 2007-11-15 8:57 dckorah+gcc at gmail dot com
2007-11-15 13:33 ` [Bug c++/34104] " pcarlini at suse dot de
0 siblings, 1 reply; 2+ messages in thread
From: dckorah+gcc at gmail dot com @ 2007-11-15 8:57 UTC (permalink / raw)
To: gcc-bugs
#include <memory>
int main(int argc, char* argv[])
{
int* intptr;
std::auto_ptr<int> i;
i = std::auto_ptr<int> (intptr);
return 0;
}
--------- code above compiles but fails run ------------
~/tests$ g++ -Wall auto_ptr.cpp
~/tests$ ./a.out
*** glibc detected *** ./a.out: munmap_chunk(): invalid pointer: 0x080485a9 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(cfree+0x1bb)[0xb7d2792b]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7eecd81]
./a.out[0x804857d]
./a.out[0x80484b3]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7cd0050]
./a.out[0x80483d1]
======= Memory map: ========
08048000-08049000 r-xp 00000000 08:03 6389816 /home/dkorah/tests/a.out
08049000-0804a000 rw-p 00000000 08:03 6389816 /home/dkorah/tests/a.out
0804a000-0806b000 rw-p 0804a000 00:00 0 [heap]
b7cb9000-b7cba000 rw-p b7cb9000 00:00 0
b7cba000-b7dfe000 r-xp 00000000 08:01 32593
/lib/tls/i686/cmov/libc-2.6.1.so
b7dfe000-b7dff000 r--p 00143000 08:01 32593
/lib/tls/i686/cmov/libc-2.6.1.so
b7dff000-b7e01000 rw-p 00144000 08:01 32593
/lib/tls/i686/cmov/libc-2.6.1.so
b7e01000-b7e04000 rw-p b7e01000 00:00 0
b7e04000-b7e0e000 r-xp 00000000 08:01 2394403 /lib/libgcc_s.so.1
b7e0e000-b7e0f000 rw-p 0000a000 08:01 2394403 /lib/libgcc_s.so.1
b7e0f000-b7e10000 rw-p b7e0f000 00:00 0
b7e10000-b7e33000 r-xp 00000000 08:01 32597
/lib/tls/i686/cmov/libm-2.6.1.so
b7e33000-b7e35000 rw-p 00023000 08:01 32597
/lib/tls/i686/cmov/libm-2.6.1.so
b7e35000-b7f1d000 r-xp 00000000 08:01 1337854 /usr/lib/libstdc++.so.6.0.9
b7f1d000-b7f20000 r--p 000e8000 08:01 1337854 /usr/lib/libstdc++.so.6.0.9
b7f20000-b7f22000 rw-p 000eb000 08:01 1337854 /usr/lib/libstdc++.so.6.0.9
b7f22000-b7f28000 rw-p b7f22000 00:00 0
b7f3c000-b7f3e000 rw-p b7f3c000 00:00 0
b7f3e000-b7f58000 r-xp 00000000 08:01 2394896 /lib/ld-2.6.1.so
b7f58000-b7f5a000 rw-p 00019000 08:01 2394896 /lib/ld-2.6.1.so
bf9f2000-bfa07000 rw-p bf9f2000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Aborted (core dumped)
--
Summary: auto_ptr error catching
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dckorah+gcc at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34104
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/34104] auto_ptr error catching
2007-11-15 8:57 [Bug c++/34104] New: auto_ptr error catching dckorah+gcc at gmail dot com
@ 2007-11-15 13:33 ` pcarlini at suse dot de
0 siblings, 0 replies; 2+ messages in thread
From: pcarlini at suse dot de @ 2007-11-15 13:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pcarlini at suse dot de 2007-11-15 13:32 -------
intptr is not initialized: when i is destructed it calls delete on the owned
pointer, that is intptr, and anything can happen. Just initialize intptr to
zero or to a value returned by new.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34104
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-15 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15 8:57 [Bug c++/34104] New: auto_ptr error catching dckorah+gcc at gmail dot com
2007-11-15 13:33 ` [Bug c++/34104] " 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).