>I would be very surprised if that variable isn't accessible
>anywhere in the rest of the function
A variable created inside a loop will not be accessable outside of that loop. Consider the following code:
Code:
#include <stdio.h>

int main ( void )
{
  int a;
  for ( a = 0; a < 5; a++ ) {
    int b = 0;
    b += a;
  }
  printf ( "%d\n", b );
  return 0;
}
The variable a is pushed onto the stack, the loop is entered and is treated as a new block, b is pushed onto the stack, the loop performs its iterations and exits. When the block is terminated, all variables declared in that block are popped from the stack, so the variable b is invalid when execution reaches the call to printf.

>because it had to be allocated on the stack when the function was jumped to.
But the loop is a separate block and thus a separate entity from the function which can declare its own automatic variables that are removed when the block returns. The same problem will occur if you throw out the loop and just use braces:
Code:
#include <stdio.h>

int main ( void )
{
  int a;
  {
    int b = 0;
    b += a;
  }
  printf ( "%d\n", b );
  return 0;
}
-Prelude