-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSO breaks backwards compatibility of ABI #3273
Comments
Thanks for the detailed report - this is a known bug that we've already fixed for VS 2022 17.6 Preview 1 and 17.5 Preview 3. We're currently working on backporting it to a 17.4.x patch release. |
Indeed, I see it was fixed in #3235. |
Yes, that change fixes the ABI incompatibility for VS 2022 version 17.6 when it eventually ships. We've gotten servicing approval to ship the fix in 17.5 and 17.4 as well. We tentatively expect the fix to ship in 17.5 Preview 3 and 17.4.4, but those may slip a release given how close we are to ship deadlines. |
Is the fix already integrated into new release of VS 17.4.4 ? |
No, I cannot see that b9adfa8 changes are present in I think MSFT team would notify us when the fix would get shipped. Let's be patient 🙂 |
@RIscRIpt is correct - we tried to get the fix into 17.4.4, but didn't get it in time for an internal deadline. It is now planned for 17.4.5. (It was successfully merged into 17.5 Preview 3 and should be available when that's released.) Thanks for your patience, we know this is a bad bug. |
Update: The fix for 17.4 has been merged for 17.4.5 and will ship in that release barring some unforeseen catastrophe. Thanks for the report! |
STL shipped with MSVC 14.34 introduced SSO (1ea95df). SSO implementation has changed
_STD::_String_val::_Bxty::_Bxty()
constructor: previously it zero-initialized_Ptr
field (in MSVC 14.33), now it initializes_Buf
field (in MSVC 14.34). SSO implementation relies on the fact that_Buf
is initialized with zeroes, however this assumption breaks whenstd::string
comes from TU compiled using older STL, where_Ptr
field was initialized instead. Whenstd::string
in old TU is initialized using a small (>8 and <16) string literal,std::string::c_str()
would return pointer to buffer which is not zero terminated properly.Command-line test case
Compiling TU using MSVC 14.33 without SSO
Compiling TU using MSVC 14.34 with SSO
Note: it's important to have
GetStringNew
, which referencesstd::basic_string
functions forcing linker to choose newstd::string
implementation forGetStringOld
.Expected behavior
I expect the following assertion to succeed
Namely
GetStringOld
should be able to initializestd::string
in a way thatstd::string::c_str()
would return a pointer to buffer which is zero-terminated correctly.Additional context
This problem was discovered when I compiled a project using MSVC 14.34 re-using LLVM compiled using MSVC 14.33. The problematic part was in
llvm::Twine::str()
.For your convenience I created a repo with reproducible example in Visual Studio solution.
The text was updated successfully, but these errors were encountered: