Don't overwrite the user's choice of compiler
Don't write past the end of the buffer
Use $HOME/.cache if $XDG_CACHE_HOME is unset.

XDG Base Directory Specification says that:

If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

(http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)