GCC, functions, and pointer arguments, warning behaviour
Posted
by James Morris
on Stack Overflow
See other posts from Stack Overflow
or by James Morris
Published on 2010-06-03T08:00:03Z
Indexed on
2010/06/03
8:04 UTC
Read the original article
Hit count: 334
I've recently updated to a testing distribution, which is now using GCC 4.4.3. Now I've set everything up, I've returned to coding and have built my project and I get one of these horrible messages:
*** glibc detected *** ./boxyseq: free(): invalid pointer: 0x0000000001d873e8 ***
I absolutely know what is wrong here, but was rather confused as to when I saw my C code where I call a function which frees a dynamically allocated data structure - I had passed it an incompatible pointer type - a pointer to a completely different data structure.
warning: passing argument 1 of 'data_A_free' from incompatible pointer type
note: expected 'struct data_A *' but argument is of type 'struct data_B *'
I'm confused because I'm sure this would have been an error before and compilation would never have completed. Is this not just going to make life more difficult for C programmers?
Can I change it back to an error without making a whole bunch of other warnings errors too?
Or am I loosing the plot and it's always been a warning?
© Stack Overflow or respective owner