This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Strange warnings using egcs-19990718.


I get the warning:

warning.c: In function `warning':
warning.c:3: warning: `status' might be used uninitialized in this function

when I compile this piece of code using egcs-19990718 on Red Hat Linux 6.0
(Intel). This is the smallest testcase for the warning, which I originally
found while compiling the Linux kernel.

/*
 * This code gives a warning about ``status being used uninitialized''
 * when compile with gcc version 2.95 19990718 (prerelease) on Red Hat
 * Linux 6.0 (Intel).
 *
 * Compile with: gcc -Wall -O1 -c warning.c
 */
int warning()
{
	int i, status;

	for (i = 0; i < 10; i++) {
		status = i;

		if (status >= 0)
			return status;

		if (status < 0) break;
	}

	return status;
}

-- 
Niels Kristian Bech Jensen -- nkbj@image.dk -- http://www.image.dk/~nkbj/

----------->>  Stop software piracy --- use free software!  <<-----------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]