Since r278177, the Posix functions in PseudoTerminal::OpenFirstAvailableMaster on windows are now inlined LLVM_UNREACHABLE instead of return 0.
This causes __assume(0) to be inlined in OpenFirstAvailableMaster, allowing the optimizer to change code because this function should never be executed. In particular, on Visual 2015 Update 3 Win32 Release builds, the optimizer skips the if (error_str) test, causing a crash if error_str is nullptr.
The added #if !defined(LLDB_DISABLE_POSIX) restore the previous behaviour (which was doing nothing and returning true, as every function was returning 0, and prevent crashes.
The crash was 100% when launching a test x86 executable (built with clang, linked with lld-link) in lldb.
I don't know if there is another fix in progress (not calling the function on Win32?), but it seems to be called from several places, so it may be simpler to fix it in PseudoTerminal.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Yeah, you're right, the previous code is used for reference was inconsistent here. Now I return false and set an error string. Also remove an hacky ifdef which was needed on previous implementation (because the master id was updated to 0), but now we leave it to -1, so it's not needed anymore.