Kevin Grittner <kgri...@ymail.com> wrote:

>> I distilled it down to the simplest case I could find which
>> failed to produce the warning; attached. Do you agree that it is
>> a compiler bug that this generates no warning?

>> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
>> -Wdeclaration-after-statement -Wendif-labels
>> -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
>> -fwrapv -fexcess-precision=standard -g -D_GNU_SOURCE -c -o
>> warning_test.o warning_test.c -MMD -MP

The actual test case I sent for gcc is what is attached here. 
Sorry for attaching the wrong file before.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
int warning_test(int a, int b, int c);
int warning_test(int a, int b, int c)
{
	int result = 0;
	int i1;
	int i2;

	i1 = i2 = 0;
	while (i1 < 2 || i2 < 2)
	{
		int cmpresult;

		switch (a)
		{
			case 1:
				if (b != c)
					cmpresult = (b < c) ? -1 : 1;
				break;
		}

		if (cmpresult < 0)
		{
			result = -1;
			break;
		}

		i1++, i2++;
	}

	return result;
}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to