Fix all GCC optimization errors

* *Maybe* uninitialized variables covered with uninitialized_var().
  I'm pretty sure they are all initialized at some point, afteR
  taking a quick at the code.
* Array subscripts below/above array bounds is covered with checks.
  REALLY unnecessary and costly but needed to keep GCC happy. :(

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>