This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57111] Core dump - invalid pointer detected after std::unique_ptr
- From: "jb.1234abcd at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 Apr 2013 22:22:44 +0000
- Subject: [Bug c++/57111] Core dump - invalid pointer detected after std::unique_ptr
- Auto-submitted: auto-generated
- References: <bug-57111-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57111
--- Comment #7 from jb <jb.1234abcd at gmail dot com> 2013-04-30 22:22:44 UTC ---
(In reply to comment #6)
> (In reply to comment #5)
> > It seems to me that the option "free-nonheap-object" does not work in gcc.
>
> You need to add -O2 (maybe -O1 is enough, sometimes you need -O3), otherwise
> gcc does not propagate the information of what p is all the way to free.
OK, that worked.
$ gcc -O1 -Wall -o free-test free-test.c
free-test.c: In function âmainâ:
free-test.c:6:7: warning: attempt to free a non-heap object âarrâ
[-Wfree-nonheap-object]