Re: 2.6.14 assorted warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux