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]

Reply via email to