GCC, functions, and pointer arguments, warning behaviour
- by James Morris
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?