Closed StephanTLavavej closed 4 years ago
@Amaroker, here's the list as you requested in https://github.com/microsoft/STL/issues/890#issuecomment-649505408. :smiley_cat:
Taking the first four:
<valarray>
: slice_array's copy ctor is missing | GH-940<iterator>
: checked_array_iterator
/unchecked_array_iterator
should have conversions | GH-943 <array>
: std::array<T,0>
doesn't compile - when type has private ctorReturning back, was not able to port:
<random>
: piecewise_linear_distribution
is still broken.So far the results about first four. Two successes:
Two failures:
Is it good enough?
Thanks for the list. I filed a bug report for DevCom-246365 as https://github.com/microsoft/STL/issues/944
There are related issues in the list, for example DevCom-246250 and DevCom-189336. The problem is that they refer to attached code. That code it not publicly available, which makes it difficult.
DevCom-334696 has been ported as https://github.com/microsoft/STL/issues/946
<exception>
: VC++: std::exception::what has wrong signature | GH-948@StephanTLavavej , I'd suggest that you add checkboxes to your message, so that we copy lines in comment, and you mark checkboxes in your message after an initial check.
<random>
: piecewise_linear_distribution
is still brokenEdit: ported as #950, @StephanTLavavej
Thanks @AlexGuteniev, @Amaroker, and @statementreply! I really appreciate it! 😺😸 I've updated the table to a checkbox list as requested, and created Remaining/In Progress/Done sections.
If anything simply can't be ported due to non-public attachments (or descriptions that don't make sense, etc.), let us know and we'll handle them separately. I've created a Blocked section for the ones you mentioned, @Amaroker.
Ported these:
<functional>
: std::is_convertible is broken for std::bind functors<valarray>
: VS doesn't trigger the assertion when the data out of bound in std::valarray<execution>
: Including Did not port:
<functional>
: Passing an object with an explicit alignment that owns a std::function by value leads to invalid free on x86 (Note: Appears different than GH-690)
Thanks @AlexGuteniev, I've updated the list again, and @CaseyCarter has linked the MS-internal bugs.
I'm still able to reproduce the DevCom-367683 std::function
alignment crash with VS 2019 16.7 Preview 3.1 (note that it is indeed x86 specific and doesn't repro for x64). I'll go ahead and port it.
note that it is indeed x86 specific and doesn't repro for x64
Double checked. Yes, probably I tried the wrong configuration.
<memory>
: _msize
& std::allocator
don't work together<any>
: std::any
doesn't link when exceptions are disabledPorted the following:
<regex>
mishandles locale-based character classes outside of the char range<regex>
: c++ regex character class case insensitive search problem<regex>
: Regex erroneously returns a match<regex>
: basic_regex wants regex_traits to provide things not required by [re.req]<regex>
: std::regex_search will wrong when the regex contains "["Did not port:
<regex>
: Instantiating std::regex("meow")
changes output of strftime
in a different thread - Non-public attachment.regex_constants::error_brace
is legitimately thrownPorted:
<random>
: std::normal_distribution
four times slower than the corresponding boost version<random>
: The <random>
header still provides the uniform_int
and uniform_real
class templates<random>
: binomial_distribution
is broken<random>
: Floating-point random number generation suboptimal due to generate_canonical()
Didn't port:
VSO-253526 | DevCom-110322 | <random>
: uniform_real_distribution<float>
generates numbers outside of the interval
As an FYI, this is a bug in the standard; there's currently a paper pending to fix it: WG21-P0952
This paper proposes a new specification of generate_canonical
, but it doesn't appear to me that this paper would address the issue of uniform_real_distribution
specification.
Amazing work - I have digested all of your newly-ported bugs, and reorganized the list accordingly (including links to your comments about the bugs that will need special attention). I've also used the "mark comment as resolved" feature to make this thread much easier to scan for pending work.
<algorithm>
: VS2017 std::min_element()
assumes the elements in the range are not modified<deque>
: std::deque::insert
performanceThanks! @msalehmsft set up automation that officially links VSO bugs to GitHub, which will enable Microsoft-internal dashboards (I think) and will also make it possible for GitHub PRs to close VSO bugs automatically (*). I've updated all currently ported bugs to use this mechanism.
I'm 80% sure that this can also be activated by contributors. For the next bug that you port, can you phrase the citations as:
"Also tracked by DevCom-publicnumber and VSO-internalnumber / AB#internalnumber."
The exact phrasing doesn't matter (you can say "Originally reported on Developer Community" etc). The new part is saying AB (for Azure Boards, apparently the new name) followed by #
(not -
like other autolinks) and the internal bug number. (The slash before is unimportant, you could say "and". I've been putting spaces around it out of paranoia.) If this works, your comment will be automatically edited by @msalehmsft to add a hyperlink (it won't appear in a comment Preview), and the internal bug will gain this special link. This must be mentioned in the original issue to create the internal link; using this syntax in issue comments below will be hyperlinked from GitHub, but not to GitHub. (We will still be citing internal bugs as VSO- in code comments etc. hence repeating both forms.)
If this works, I'll update the instructions above.
(*) GitHub PRs will need to say "Fixes AB#nnn" to auto-close bugs (and apparently this accepts "fix", "fixes", "fixed" but not "close"/"resolve").
I have ported DevCom-330322 as GH-1033.
Did not port:
<scoped_allocator>
: std::scoped_allocator_adaptor
copy constructor does not copy construct inner allocatorsDevCom bugs are not duplicates, and neither of them is reproducible
DevCom-87221 contains clear repro of the problem that seems to be fixed already, but apparently was present in old Visual Studio:
#include <iostream>
#include <memory>
#include <scoped_allocator>
#include <string>
#include <vector>
#include <cassert>
#include <iostream>
#include <cstddef>
#include <vector>
#include <scoped_allocator>
template <class T>
struct SimpleAllocator
{
int state;
using value_type = T;
//SimpleAllocator() : state(-1)
//{
//}
SimpleAllocator(int state) : state(state)
{
}
SimpleAllocator(const SimpleAllocator& a) : state(a.state)
{
}
template<class U>
SimpleAllocator(const SimpleAllocator<U>& a) : state(a.state)
{
}
T* allocate(std::size_t n)
{
return reinterpret_cast<T*>(malloc(n * sizeof(T)));
}
void deallocate(T* p, std::size_t n)
{
free(p);
}
};
template <class T, class U>
bool operator==(const SimpleAllocator<T>& a, const SimpleAllocator<U>& b)
{
return a.state == b.state;
}
template <class T, class U>
bool operator!=(const SimpleAllocator<T>& a, const SimpleAllocator<U>& b)
{
return a.state != b.state;
}
int main()
{
SimpleAllocator<int> a1(1);
SimpleAllocator<int> a2(2);
std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>> sa(a1, a2);
std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>> sa2(sa);
std::vector<std::vector<int>, std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>>> v(sa2);
assert(v.get_allocator().inner_allocator() == sa.inner_allocator());
return 0;
}
The repro does not compile in 19.27.29009.1
It compiles with either changing outer allocator to SimpleAllocator<std::vector<int>>
, or with defining #define _ENFORCE_MATCHING_ALLOCATORS 0
. In either cases it works.
DevCom-246251 contains clear repro:
#include <iostream>
#include <memory>
#include <scoped_allocator>
#include <string>
#include <vector>
using arena = int;
template<typename T>
struct arena_allocator :std::allocator<T>
{
using propagate_on_container_copy_assignment = std::false_type;
using propagate_on_container_move_assignment = std::true_type;
using propagate_on_container_swap = std::false_type;
template<typename U>
struct rebind { using other = arena_allocator<U>; };
arena* pa;
arena_allocator() = default;
arena_allocator(arena* pa) :pa{ pa } {}
template<typename U>
arena_allocator(const arena_allocator<U>& x) : pa{ x.pa } {}
};
using string =
std::basic_string<char, std::char_traits<char>, arena_allocator<char>>;
using vector = std::vector<
string,
std::scoped_allocator_adaptor<arena_allocator<string>, arena_allocator<char>>
>;
int main()
{
arena as = 0, ac = 0;
vector v{
vector::allocator_type{
arena_allocator<string>{&as},arena_allocator<char>{&ac}} };
v.emplace_back("boost");
std::cout << (v.get_allocator().pa == &as) << "\n";
std::cout << (v.begin()->get_allocator().pa == &ac) << "\n";
}
Should print
1
1
According to bug report, it prints in 19.11.25331.0 (x86)
1
0
According to bug report, in 19.00.23026 it prints the expected output.
So, I've tried 19.26.28806 and it prints the correct results. Possible reasons:
DevCom-246246 contains a repro is only slightly different from DevCom-87221 . The main difference part is that line from DevCom-246246:
std::vector<int, std::scoped_allocator_adaptor<SimpleAllocator<int>>> v(sa2);
Is replaced with line from DevCom-87221:
std::vector<std::vector<int>, std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>>> v(sa2);
(thanks @Amaroker for pointing that out)
So, the DevCom-246246 reporduced, but it does no look like a valid bug.
Ported:
@AlexGuteniev
The repro code that you showed above for DevCom-246246 seems to actually belong to DevCom-246251. Can you double check, did you mix them up? The titles are very similar.
The repro of DevCom-246246 causes an assertion failure.
Can you double check, did you mix them up? The titles are very similar.
I've checked, Yes, almost duplicate title, plus code of DevCom-246246 and DevCom-87221 is similar. Still I cannot make a valid bug of these already three different repros.
The repro of DevCom-246246 causes an assertion failure.
The repro is invalid. This assertion:
std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>> sa2(sa);
std::vector<int, std::scoped_allocator_adaptor<SimpleAllocator<int>>> v(sa2);
assert(v.get_allocator().inner_allocator().i == sa.inner_allocator().i);
should fire on a correct implementation. The scoped_allocator_adaptor
used with vector
has only one allocator type, so get_allocator().inner_allocator()
returns a copy of get_allocator()
. The assert passes if changed to:
assert(v.get_allocator().inner_allocator().i == 1);
or:
assert(v.get_allocator().inner_allocator().inner_allocator().inner_allocator().inner_allocator().i == 1);
The repro also works if we change the vector
specialization to be what the submitter intended:
std::scoped_allocator_adaptor<SimpleAllocator<int>, SimpleAllocator<int>> sa2(sa);
std::vector<int, decltype(sa)> v(sa2);
assert(v.get_allocator().inner_allocator().i == sa.inner_allocator().i);
I can believe there was a bug here in 19.11, but it seems to have been fixed by @BillyONeal's work in <scoped_allocator>
in that era. The copy constructor was working by 19.14, at least: https://godbolt.org/z/75Kr3v.
Did not port:
- VSO-454466 | DevCom-246251 |
: std::scoped_allocator_adaptor does not properly construct inner allocator - VSO-471859 | DevCom-87221 DevCom-246246 |
<scoped_allocator>
:std::scoped_allocator_adaptor
copy constructor does not copy construct inner allocatorsDevCom bugs are not duplicates, and neither of them is reproducible
Thanks for the investigation, @AlexGuteniev. I'll close these as fixed.
I was able to port DevCom-77779 and DevCom-246249 , see https://github.com/microsoft/STL/issues/939#issuecomment-657100932
Originally I noted that DevCom-246249 does not have public attachment, but DevCom-77779 has an attachment in its comment, which is clearly that missing atttachment.
(It would be more convenient to move already fixed or invalid bugs to yet another section of this issue instead of striking. Or in the same section with ported. Negative result is also a result)
Porting:
(duplicates)
<xtree>
: C2664 error 'std::swap
with std::exception_ptr
' appear in Error list.Suspicious. @StephanTLavavej , please take a look: I've ported DevCom-657074 as GH-1037 , but the error is not C2664, and it has nothing to do with std::exception_ptr
.
<chrono>
: No diagnostic for truncating conversion of chrono
duration
<vector>
: VS 2017 15.7.3 ignores explicit keyword<iomanip>
: std::get_time doesn't work as intended<xlocinfo>
: Mismatched malloc
/free
in locale libraryThanks @Amaroker, @AlexGuteniev, and @fsb4000! (And @CaseyCarter for resolving bugs!) I've updated the (rapidly shrinking :heart_eyes_cat:) main list, with separate sections for invalid and fixed bugs. I've labeled all of your amazingly-ported bugs and made sure they're linked up on the MS side.
@AlexGuteniev - I looked at the GH-1037 xtree swap bug, and I believe that the error C2664 complaining about exception_ptr
vanished when we changed exception_ptr
's swap
to be a hidden friend. (That was Microsoft-internal MSVC-PR-197905 which @BillyONeal merged on Aug 20, 2019, immediately before the beginning of GitHub history.) So it's nothing to be concerned about, and you've accurately captured the issue. Thanks for double-checking!
<filesystem>
: Use of std::filesystem::path
causes link error on UWPstd._Tree_unchecked_const_iterator
)<iomanip>
: std::get_time
asserts with "istreambuf_iterator is not dereferenceable" when format is longer than the stream<random>
: uniform_real_distribution<float>
generates numbers outside of the intervalThanks @fsb4000! I've labeled, linked up, and recorded all of your ported bugs. Extra thanks for verifying the already-fixed UWP filesystem bug, and finding the get_time duplicate.
By the way, note that you can take advantage of GitHub autolinking in this repo, you don't need to write links manually. (GH-number works identically to #number in all repos; we've added the DevCom-number and VSO-number syntax, which is a feature available to Pro/Enterprise repos.)
<sstream>
: basic_stringbuf
can't grow to more than INT_MAX
, and can be completely broken if initialized with a string longer than that<locale>
: std::ctype<char>::blank
return true for all space-characterscout
, blank output without permission.<iomanip>
: Case sensitivity when parsing months Thanks again @fsb4000! I've labeled and linked up all of those bugs.
I've also added 3 new DevCom bugs to the list; with them, there are only 9 Remaining and 4 Blocked! :smiley_cat:
This one appears to be compiler issue.
Test case without std::thread
a.cpp:
#include "c.h"
#include <iostream>
static void f()
{
invoke([&]() { std::cout << "lambda1\n"; })();
}
void g();
int main()
{
f();
g();
}
b.cpp:
#include "c.h"
#include <iostream>
static void f ()
{
invoke([&]() { std::cout << "lambda2\n"; })();
}
void g () { f (); }
c.h:
#pragma once
template<class F>
void invoke_impl(void* f) {
auto fn = static_cast<F*>(f);
(*fn)();
}
template<class F>
struct invoke
{
invoke(F f)
{
fn = &invoke_impl<F>;
context = &f;
}
void operator()() { fn(context); }
void (*fn)(void*);
void* context;
};
This one appears to be compiler issue.
And it seems to be regression: Visual Studio 2019 16.7 prints:
lambda2
lambda2
But Visual Studio 2017 (15.9.25) prints:
lambda1
lambda2
As part of our work to migrate all STL development to GitHub, we're porting our Microsoft-internal bug database ("VSO"; originally Visual Studio Online, renamed Azure DevOps and Azure Boards) to GitHub issues. Some bugs were directly filed in VSO (by STL maintainers and other people within MS, sometimes on behalf of customers), while some were replicated from Developer Community ("DevCom").
As part of this porting process, we aren't resolving any bugs. The intended goal is for GitHub to be the source of truth for all bug reports (in addition to performance/enhancement/etc. suggestions); it's also our preferred place for new issues to be filed. (Issues filed on GitHub aren't replicated anywhere else, so it's the most convenient for us.) However, users who filed DevCom bugs in the past (or continue to file them in the future) will have their bugs remain active, and will receive feedback from STL maintainers there (in addition to their bugs being ported to GitHub issues where they can be linked to pull requests etc.). Additionally, VSO bugs (whether filed directly or replicated from DevCom) will remain active because our bosses and boss-like entities prefer that.
"Porting" a bug to GitHub involves capturing the true essence of the bug report, without distorting or over-simplifying it. (Much like compiler bugs, STL bugs can be very sensitive to the exact code, compiler options, etc. used.) However, we also want our GitHub issues to be readable and comprehensible, so that both maintainers and contributors can understand what's wrong and easily investigate a fix. So, when possible, it's nice to clean up the title and test case, so that they're as clear and minimal as possible. (It is often a good idea to have an "original repro" and "reduced repro", to avoid the dangers of over-simplifying away something important - and I speak as someone who has over-simplified a dozen compiler bug reports in the past.) It's better to err on the side of less cleanup than more - fixing only grammatical issues is fine.
Example bugs ported from DevCom: GH-371 (from DevCom-758960) and GH-503 (from DevCom-371962)
While only the STL maintainers will be able to port the MS-internal bugs that were directly filed in VSO, the DevCom database is publicly viewable, so we could use some help with those bugs. :smile_cat:
Here's a list of the DevCom bugs, along with their VSO IDs and Titles. (Sometimes, multiple DevCom bugs were linked to a single VSO bug, when we had a strong belief that they're all duplicates.) I generated this by hand, so if anything looks wrong (e.g. mismatched VSO/DevCom bugs), please let me know. Note that everyone in this repo has the ability to use our Custom Autolinks in GitHub issues/comments; you can just say DevCom-NNN instead of copying a whole URL.
In general, we have already tried to resolve clearly-invalid bugs, and obvious duplicates, but there are several categories of possible duplicates that we haven't resolved because there may be multiple underlying issues.
Finally, in addition to the title and repro, ported bugs should mention the DevCom and VSO IDs, so we can easily navigate to the linked bugs:
AB followed by
#
(not-
like other autolinks) will activate automation: your issue will be automatically edited by @msalehmsft to add a hyperlink (it won't appear in a Preview), and the internal bug will gain a special link. This must be mentioned in the original issue to create the internal link; using this syntax in issue comments below will be hyperlinked from GitHub, but not to GitHub.Please don't use AB#nnn syntax here, in this thread as it will link "Port DevCom bugs to GitHub" to whatever's mentioned. DevCom-nnn and VSO-nnn are safe to mention anywhere.
:beetle: Remaining: VSO ID | DevCom ID(s) | Original VSO Title
:hourglass_flowing_sand: In Progress
:warning: Blocked
<iomanip>
:std::get_time
cause Debug Assertion Failed when the second parameter have extra delimiter<regex>
: Instantiatingstd::regex("meow")
changes output ofstrftime
in a different thread<iomanip>
:std::get_time
does not report fail on an invalid date<xlocale>
et al. locale allocates memory while holding the locale lock<regex>
std::regex_search
causes infinite recursion on a sample that works with Visual Studio 2013 and gcc:x: Resolved As Invalid
<scoped_allocator>
:std::scoped_allocator_adaptor
copy constructor does not copy construct inner allocators<iostream>
: When a double-width characters incout
, blank output without permission.:hammer_and_wrench: Compiler Bug, Reduced To Library-Free Test Case And Sent To Compiler Team
std::thread
ends up calling lambda from other file with new lambda engine<functional>
: Passing an object with an explicit alignment that owns astd::function
by value leads to invalid free on x86:smile_cat: Fixed
<scoped_allocator>
:std::scoped_allocator_adaptor
does not properly construct inner allocator<complex>
: Passing a double tostd::arg
returns wrong result.<valarray>
:slice_array
's copy ctor is missing, the same withmask_array
,gslice_array
,indirect_array
<random>
:piecewise_linear_distribution
is still broken<filesystem>
: Use ofstd::filesystem::path
causes link error on UWPstd::stack<Class *>
for x64 while for x86 it works fine:heavy_check_mark: Done
/Wall
<streambuf>
:basic_streambuf
doesn't support 64-bit properly<locale>
: Eagerly-allocated facets in non-defaultstd::locale
can lead to ODR violation between DLL-exported version and header version<array>
:std::array<T,0>
doesn't compile - when type is not default constructible<iterator>
:checked_array_iterator
/unchecked_array_iterator
should have conversions<iomanip>
:get_time
should parse format without delimiters<mutex>
: changemutex
to be anSRWLOCK
<exception>
:std::exception::what
has wrong signature<future>
:std::async
withstd::launch::async
policy does not behave as if in new thread in regards tothread_local
<functional>
:std::is_convertible
is broken forstd::bind
functors<valarray>
: VS doesn't trigger the assertion when the data out of bound instd::valarray
<execution>
: Including with/clr
enabled results in compiler error.<memory>
:_msize
&std::allocator
don't work together<any>
:std::any
doesn't link when exceptions are disabled<regex>
mishandles locale-based character classes outside of the char range<regex>
: c++ regex character class case insensitive search problem<regex>
: Regex erroneously returns a match<regex>
:basic_regex
wantsregex_traits
to provide things not required by[re.req]
<regex>
:regex_search
behaves incorrectly when the regex containsR"(\[)"
<regex>
: Grouping within repetition causes regex stack error<random>
: Floating-point random number generation suboptimal due togenerate_canonical()
<random>
:binomial_distribution
is broken<random>
: The<random>
header still provides theuniform_int
anduniform_real
class templates<random>
:std::normal_distribution
four times slower than the corresponding boost version<regex>
: Error C2664 instd::regex_traits::transform
<algorithm>
:std::min_element()
assumes the elements in the range are not modified<deque>
:std::deque::insert
performance<locale>
: Empty locale name and UTF-8 issues<string>
,<vector>
Debug version of STL is not exception safe and causesterminate()
to be called under low memory<deque>
: Adeque<T>
whereT
is move-only, when nested invector
, does not compile<xtree>
:_Tree
move constructor incorrectly swaps<chrono>
: No diagnostic for truncating conversion ofchrono
duration
<vector>
: VS 2019 ignoresexplicit
keyword<xlocinfo>
: Mismatched call tofree
whenmalloc
is replaced with user implementation<locale>
: Cannot run in Release mode and throw unhandled exception:std::runtime_error
- UTF8 to GBKstd._Tree_unchecked_const_iterator
)<iomanip>
:std::get_time
asserts with "istreambuf_iterator
is not dereferenceable" when format is longer than the stream<random>
:uniform_real_distribution<float>
generates numbers outside of the interval<locale>
:std::ctype<char>::blank
return true for all space-characters<iostream>
: hexfloat stream output does not ignore precision as it should<iomanip>
: Case sensitivity when parsing months<fstream>
:ifstream
putback is still broken<locale>
: locale initialization incorrect in debug mode