gcc 4.6.3 incorrectly detects free() of non-heap object
This gcc code:
Code:
void* d __attribute__((cleanup(free))) = malloc(size); gives this error: Code:
attempt to free a non-heap object ‘d’ [-Werror] This works however, Code:
void *d = malloc(size); I can't find a simple pragma to disable this check; this fails: Code:
#pragma GCC diagnostic ignored "-Wno-free-nonheap-object" |
From the GCC documentation on the cleanup attribute:
Quote:
Code:
#include <stdlib.h> So your original problem was that &d was being passed to free(), which of course bad. |
Quote:
|
All times are GMT -5. The time now is 07:03 AM. |