Hoist for variables to the top of their function.

Fixes compilation under GCC.