Reduce the generation of unreachable code
These fixes are based on discoveries by #838 and compiling with -Werror=unreachable-code using clang-9.
These fixes are based on discoveries by #838 and compiling with -Werror=unreachable-code using clang-9.