Fix some warnings found by clang.

Closes #9032.