This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57111] Core dump - invalid pointer detected after std::unique_ptr


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]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]