The function sysThreadStartup in sys.C doesn't return a value when the thread is being terminated. This is undefined behaviour that can be detected by appropriate compiler flags (e.g. -fsanitize=undefined on gcc 4.9).
This bug seems to cause crashes in CodePatchSyncRequestVisitorTest when compiling with clang: the bootimage runner complains about a TLS error. Many of the tests in the pre-commit test run fail with the same error message when compiling with clang.