Worked around a GCC compiler bug. Also tidied up a bunch of GCC warnings.