Backport 9ba950d860d32f6a1889b9f0fa8479ea55375699 to release-0.3
Include chksquare(), the whole point of this backport
Merge pull request #8632 from JuliaLang/sf/backport_anj/tri

Backport 9ba950d8 to release-0.3