Messages in this thread | | | Date | Mon, 31 Oct 2005 11:53:27 +1100 | From | Paul Mackerras <> | Subject | Re: 2.6.14 assorted warnings |
| |
Alan Cox writes:
> gcc is a *LOT* smarter than you give it credit for. It will not warn for > cases where it isn't able to tell how foo is used passed with &foo. It > will warn for cases where it can
Gcc thinks it is a lot smarter than it actually is, in fact. :)
The usual case where it gives a bogus warning is where the value of one variable is correlated with the defined-ness of another, for example:
found = 0; for (i = 0; i < N; ++i) { if (a[i] == foo) { x = b[i]; found = 1; break; } } if (found) bar(x);
Gcc will warn on the use of x when in fact it is perfectly OK, and we get quite a few of these in compiling a kernel. At a minimum, I would like to be able to disable the "may be used uninitialized" warnings while still getting the "is used uninitialized" warnings.
Paul. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |