Make your own picture of the situation. The following is an example of one use of an uninitialized variable that goes undetected by the new GCC at the -O3 optimization level:
312 static int packet_reply(const packet_t packet)
313 {
314 ipc_callid_t callid;
315 size_t size;
316
317 if (!packet_is_valid(packet))
318 return EINVAL;
319
320 if (size != packet->length)
321 return ENOMEM;
And yes, packet is valid and line 320 is being reached. This and other examples can be found here:
- Comparison with an uninitialized variable,
- Passing an uninitialized variable to another function,
- Function leaves its output argument uninitialized.
2 komentářů:
I think -Wextra would have caught that, but it turns on a plethora of overly annoying and pedantic warnings that in turn have to be squelched.
I only turn it on when I'm getting strange behaviour and have gone 'snow blind' when looking at the code. By snow blind, I mean I wouldn't see a mistake if it were right in front of me, due to just staring at it for too long.
This code is being built with -Wextra, the problem seems to be in GCC itself rather than in an omitted warning option.
Post a Comment