-
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
<algorithm>
: reverse_copy
is mistakenly vectorized for pair<int&, int&>
on 32-bit targets
#4686
Comments
Thanks - this is a regression presumably going back to #804 in VS 2019 16.8. |
I think this should be fixed by implementing the paper. I have some special algorithms implemented directly in application code, that also have this assumption, and making the traits behaving expected would fix those too. |
Until the paper can't be implemented, can have workaround with transition comment though. |
I think I can implement the workaround. Workaround for |
Author of P3279R0 here. (I admit R0 is a mess; I'm planning an R1 that will be a different kind of mess. Sorry.) @AlexGuteniev says "I think this should be fixed by implementing [P3279]." P3279 proposes that C++ should redefine the meaning of Therefore, the appropriate way to "implement P3279" today, if you want to take @AlexGuteniev's advice (and mine), is to anticipate the paper's changes and make Microsoft's On my blog I have a whole series of "#sd-8-adjacent" guidelines; and though I haven't written it up yet, certainly one of those guidelines should be "Don't go out of your way to make a type falsely advertise trivial copyability when you don't want people to trivially copy it." I think you can (and should) assume that users will follow that guideline instinctively. Your single solitary problem here is that your own The bug report here concerns the false-advertising of See further pre-filing discussion on the cpplang Slack. |
Hmm, the crux of MSVC STL's
I think this is possible. I'm preparing a patch making vectorization correctly applied for regular trivially copyable classes (which are trivially copy & move constructible & assignable with expected semantics), while ruling out your BTW, now I guess it would be better to add new traits of names |
There're still some unresovlable problems though. Given Edit: there's already one such paper, see below. |
I covered that case in "When is a trivially copyable type not trivially copyable?" (2018-07-13), and in the paper P1153R0 Copying volatile subobjects is not trivial (2018); but ended up dropping P1153. IIRC, I dropped it simply because I thought it wasn't worth spending time on: The library never goes out of its way to care about
Please don't use any "trick" in Microsoft's etc. etc. Microsoft's |
I disagree. With the Core Language as it stands today, our We should patch this optimization, and audit the STL for all other uses of If other third-party libraries made the same mistake that we did, they should also patch themselves. |
We'll revisit this in July 2024. |
I disappointedly found that while it's possible to rule out I guess at least we need the |
Describe the bug
From DevCom-10662768.
MSVC STL's
pair<int&, int&>
is trivially copyable but not trivially copy assignable. Currently, vectorization ofreverse_copy
incorrectly detects the element type withis_trivially_copyable
, which is problematic withpair<int&, int&>
and its friends.STL/stl/inc/algorithm
Lines 5095 to 5115 in 63354c3
STL/stl/inc/algorithm
Lines 5175 to 5192 in 63354c3
Command-line test case
Expected behavior
The output should be
A 64-bit target program outputs the correct results.
STL version
Additional context
See also WG21-P3279R0.
The text was updated successfully, but these errors were encountered: