Fix bug in the iterator for SpDiagIterator, and some other cleanups.
Fix #5004.
Merge branch 'master' of github.com:JuliaLang/julia