Compile warnings and kernel crash warning: statement is unreachable

I am getting strange compile warnings that lead to a kernel crash. The compile message is:

[font=“Courier”]warning: statement is unreachable[/font]

The following code causes this problem. The kernel starts but then crashes (and the screen flickers repeatedly and then stops). The supposedly unreachable statement is the “if (val[6] == 14 && …” line. I do not understand why because the code appears legitimate.

unsigned int val[7];

	for(int i = 0; i < 7; i++)

  val[i] = getCardValue(all[i]);

	selectionSort(val);

	unsigned int count = 1;

	for(int i = 6; 6 > 0; i--)

	{

  if (val[i] == val[i-1] + 1)

  {

  	count++;

  	if (count == 5)

    return 5000 + val[i+3];

  }

  else

  {

  	count = 1;

  }

	}

	if (val[6] == 14 && val[0] == 2 && val[1] == 3 && val[2] == 4 && val[3] == 5)

  return 5005;

	else

  return 0;

Any ideas? I appreciate any help.

If this is not just a typo I wouls suggest correcting the

for(int i = 6; 6 > 0; i--)

for 6 > 0 might be a problem ;)

Vrah