Compiled with gcc/gfortran and corrected most warnings.

The remanining warnings are mostly related to argument lists, which
requires more careful thought for the eventual reorganization.