Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New bug in VS 2019 C++ IDE likely cause by: sort(execution::par, v1.begin(), v1.end());

64 views
Skip to first unread message

Bob Langelaan

unread,
Apr 13, 2020, 12:14:07 PM4/13/20
to
This code used to work in earlier version of MS VS 2019:

vector<size_t> v1(two_hundred_million);

for (int i = 0; i < two_hundred_million; ++i) {
v1[i] = randomInt(engine);// random number 1 to 4 billion
}

sort(execution::par, v1.begin(), v1.end());

Now exits with following message:

C:\Users\bobl0\Documents\Visual Studio 2019\Projects\BobDebug4\Release\BobDebug4.exe (process 22908) exited with code -1073740791.
Press any key to close this window . . .

Code executed in Release mode, not Debug mode.
NOTE: When executed in Debug mode, it completes successfully, though it takes 133 seconds to complete where it took 4 seconds in Release mode when that mode still worked.

Some additional code defined previous to code shown above:

const size_t two_hundred_million = 200000000;

default_random_engine engine( static_cast<unsigned int>( time(0) ) );
uniform_int_distribution<size_t> randomInt( 1, four_billion);

Default settings in IDE other than I have selected “ISO C++ 17 Standard (for the field “C++ Language Standard”). This is required in order to use this updated version of the sort algorithm.



========================================================================

Some additional info pulled from VS IDE:

Microsoft Visual Studio Community 2019
Version 16.5.3
VisualStudio.16.Release/16.5.3+30002.166
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Community

Visual C++ 2019 00435-60000-00000-AA945
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019 16.5.236.49856
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0 16.5.236.49856
Azure App Service Tools v3.0.0

C# Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter 16.5.20041.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30207.1

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

NuGet Package Manager 5.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python 16.5.20041.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support 16.5.20041.1
Conda support for Python projects.

Python - Django support 16.5.20041.1
Provides templates and integration for the Django web framework.

Python - IronPython support 16.5.20041.1
Provides templates and integration for IronPython-based projects.

Python - Profiling support 16.5.20041.1
Profiling support for Python projects.

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools 16.0.20225.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.8.0.0 for F# 4.7 16.5.0-beta.20181.6+85af456066acd4e76d2bc7821b44a325e46f2fca
Microsoft Visual F# Tools 10.8.0.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Unity 4.5.1.0
Visual Studio Tools for Unity

========================================================================

And some more info:

OS Name Microsoft Windows 10 Home
Version 10.0.18363 Build 18363
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-ATH7RCS
System Manufacturer System manufacturer
System Model System Product Name
System Type x64-based PC
System SKU SKU
Processor AMD Ryzen 7 3700X 8-Core Processor, 3593 Mhz, 8 Core(s), 16 Logical Processor(s)
BIOS Version/Date American Megatrends Inc. 0807, 2019-07-08
SMBIOS Version 3.2
Embedded Controller Version 255.255
BIOS Mode UEFI
BaseBoard Manufacturer ASUSTeK COMPUTER INC.
BaseBoard Product TUF GAMING X570-PLUS (WI-FI)
BaseBoard Version Rev X.0x
Platform Role Desktop
Secure Boot State Off
PCR7 Configuration Binding Not Possible
Windows Directory C:\Windows
System Directory C:\Windows\system32
Boot Device \Device\HarddiskVolume2
Locale United States
Hardware Abstraction Layer Version = "10.0.18362.628"
User Name DESKTOP-ATH7RCS\bobl0
Time Zone Pacific Daylight Time
Installed Physical Memory (RAM) 15.9 GB
Total Physical Memory 15.9 GB
Available Physical Memory 4.88 GB
Total Virtual Memory 25.7 GB
Available Virtual Memory 4.35 GB
Page File Space 9.80 GB
Page File C:\pagefile.sys
Kernel DMA Protection Not Available
Virtualization-based security Not enabled
Device Encryption Support Reasons for failed automatic device encryption: TPM is not usable, PCR7 binding is not supported, Hardware Security Test Interface failed and device is not Modern Standby, Un-allowed DMA capable bus/device(s) detected, WinRE is not configured, TPM is not usable
Hyper-V - VM Monitor Mode Extensions Yes
Hyper-V - Second Level Address Translation Extensions Yes
Hyper-V - Virtualization Enabled in Firmware No
Hyper-V - Data Execution Protection Yes

Bonita Montero

unread,
Apr 13, 2020, 1:58:28 PM4/13/20
to
This works:

#include <iostream>
#include <random>
#include <limits>
#include <vector>
#include <algorithm>
#include <execution>

using namespace std;

int main()
{
size_t const COUNT = 200'000'000;
vector<size_t> vec( COUNT );
minstd_rand lce;
uniform_int_distribution<size_t>
uid( 0, numeric_limits<size_t>::max() );
for( size_t &value : vec )
value = uid( lce );
sort( execution::parallel_policy(), vec.begin(), vec.end() );
return EXIT_SUCCESS;
}

Mike Terry

unread,
Apr 13, 2020, 3:35:40 PM4/13/20
to
On 13/04/2020 17:13, Bob Langelaan wrote:
> This code used to work in earlier version of MS VS 2019:
>
> vector<size_t> v1(two_hundred_million);
>
> for (int i = 0; i < two_hundred_million; ++i) {
> v1[i] = randomInt(engine);// random number 1 to 4 billion
> }
>
> sort(execution::par, v1.begin(), v1.end());
>
> Now exits with following message:
>
> C:\Users\bobl0\Documents\Visual Studio 2019\Projects\BobDebug4\Release\BobDebug4.exe (process 22908) exited with code -1073740791.
> Press any key to close this window . . .

-1073740791 is the NTStatus for stack buffer overrun, in case this helps
anyone...

Mike.

Keith Thompson

unread,
Apr 13, 2020, 4:24:07 PM4/13/20
to
Bob Langelaan <bobl...@gmail.com> writes:
> This code used to work in earlier version of MS VS 2019:
>
> vector<size_t> v1(two_hundred_million);
>
> for (int i = 0; i < two_hundred_million; ++i) {
> v1[i] = randomInt(engine);// random number 1 to 4 billion
> }
>
> sort(execution::par, v1.begin(), v1.end());
>
> Now exits with following message:
>
> C:\Users\bobl0\Documents\Visual Studio 2019\Projects\BobDebug4\Release\BobDebug4.exe (process 22908) exited with code -1073740791.
> Press any key to close this window . . .
[153 lines deleted]

You provided a lot of information, which I'm sure is helpful.
But the most helpful thing you could provide is a complete
self-contained program that exhibits the problem. If I want to
copy-and-paste your code and try it myself, I have to add enough
declarations to make it compile -- and I can't be certain whether
there are critical differences beween my code and your code.

Please show us a complete program, including a fully defined main()
function and all required #include directives.

https://stackoverflow.com/help/minimal-reproducible-example

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Marcel Mueller

unread,
Apr 14, 2020, 2:13:16 AM4/14/20
to
Am 13.04.20 um 21:35 schrieb Mike Terry:
> On 13/04/2020 17:13, Bob Langelaan wrote:
>> This code used to work in earlier version of MS VS 2019:
>>
>>        vector<size_t> v1(two_hundred_million);
>>
>>        for (int i = 0; i < two_hundred_million; ++i) {
>>            v1[i] = randomInt(engine);// random number 1 to 4 billion
>>        }
>>
>>        sort(execution::par, v1.begin(), v1.end());
>>
>> Now exits with following message:
>>
>> C:\Users\bobl0\Documents\Visual Studio
>> 2019\Projects\BobDebug4\Release\BobDebug4.exe (process 22908) exited
>> with code -1073740791.
>> Press any key to close this window . . .
>
> -1073740791 is the NTStatus for stack buffer overrun, in case this helps
> anyone...

Maybe a missing guard page access.
This would explain why debug succeeds.


Marcel

Öö Tiib

unread,
Apr 14, 2020, 3:34:44 AM4/14/20
to
On Monday, 13 April 2020 19:14:07 UTC+3, Bob Langelaan wrote:
> This code used to work in earlier version of MS VS 2019:
>
> vector<size_t> v1(two_hundred_million);
>
> for (int i = 0; i < two_hundred_million; ++i) {
> v1[i] = randomInt(engine);// random number 1 to 4 billion
> }
>
> sort(execution::par, v1.begin(), v1.end());
>
> Now exits with following message:
>
> C:\Users\bobl0\Documents\Visual Studio 2019\Projects\BobDebug4\Release\BobDebug4.exe (process 22908) exited with code -1073740791.
> Press any key to close this window . . .
>
> Code executed in Release mode, not Debug mode.
> NOTE: When executed in Debug mode, it completes successfully, though it takes 133 seconds to complete where it took 4 seconds in Release mode when that mode still worked.
>
> Some additional code defined previous to code shown above:
>
> const size_t two_hundred_million = 200000000;
>
> default_random_engine engine( static_cast<unsigned int>( time(0) ) );
> uniform_int_distribution<size_t> randomInt( 1, four_billion);
>
> Default settings in IDE other than I have selected “ISO C++ 17 Standard (for the field “C++ Language Standard”). This is required in order to use this updated version of the sort algorithm.

Can't reproduce. It can be it is about something in undisclosed code or
in compiler command line. Post those details too or if you already
discovered what was wrong then don't be embarrassed but tell us. Happens
all the time.


Juha Nieminen

unread,
Apr 14, 2020, 5:44:46 AM4/14/20
to
Bob Langelaan <bobl...@gmail.com> wrote:
> This code used to work in earlier version of MS VS 2019:

I'm somewhat certain that Visual Studio engineers don't read this newsgroup.
You should report this through the proper Microsoft channels.

Kenny McCormack

unread,
Apr 14, 2020, 4:18:22 PM4/14/20
to
In article <r740lu$irv$1...@adenine.netfront.net>,
Where it will go directly to /dev/null.

You get more play and feedback posting to Usenet.

Therefore, I support posting it here.

--
Conservatives want smaller government for the same reason criminals want fewer cops.

Paavo Helde

unread,
Apr 14, 2020, 6:07:42 PM4/14/20
to
14.04.2020 23:18 Kenny McCormack kirjutas:
> In article <r740lu$irv$1...@adenine.netfront.net>,
> Juha Nieminen <nos...@thanks.invalid> wrote:
>> Bob Langelaan <bobl...@gmail.com> wrote:
>>> This code used to work in earlier version of MS VS 2019:
>>
>> I'm somewhat certain that Visual Studio engineers don't read this newsgroup.
>> You should report this through the proper Microsoft channels.
>
> Where it will go directly to /dev/null.
>
> You get more play and feedback posting to Usenet.
>
> Therefore, I support posting it here.

I have reported MSVC bugs to Microsoft and they got fixed (after a
couple of years, but still).

Not that this particular issue is bound to be a compiler bug, we have
not yet seen a self-contained demo case. When I reported a bug I
included a destilled demo program along with a VStudio project, plus a
crashing compiled .exe.

Alf P. Steinbach

unread,
Apr 14, 2020, 7:02:25 PM4/14/20
to
On 14.04.2020 22:18, Kenny McCormack wrote:
> In article <r740lu$irv$1...@adenine.netfront.net>,
> Juha Nieminen <nos...@thanks.invalid> wrote:
>> Bob Langelaan <bobl...@gmail.com> wrote:
>>> This code used to work in earlier version of MS VS 2019:
>>
>> I'm somewhat certain that Visual Studio engineers don't read this newsgroup.
>> You should report this through the proper Microsoft channels.
>
> Where it will go directly to /dev/null.

That's not my experience.

Latest communication from them, two days ago:

<<
Hi Alf P. Steinbach,

Nina Wang [MSFT] changed the status of the following problem:

"Opening empty .rc file hangs + crashes + relaunches Visual Studio"

to Need More Info and added a comment.

Thank you for sharing your feedback! We've according to your steps
to repro the issue, but we cannot reproduce it on 16.5.3, in this case,
could you please try to below steps? 1. Repair your VS via installer 2.
Update to latest VS 2019 version Thanks
>>


> You get more play and feedback posting to Usenet.
>
> Therefore, I support posting it here.

Different kinds of feedback. Usenet denizens bring a lot of experience
and intelligence to the table. Microsoft brings the ability to fix the
compiler, which they usually do when I report something.


- Alf

Richard

unread,
Apr 15, 2020, 12:37:24 PM4/15/20
to
[Please do not mail me a copy of your followup]

Keith Thompson <Keith.S.T...@gmail.com> spake the secret code
<87zhbfi...@nosuchdomain.example.com> thusly:

>But the most helpful thing you could provide is a complete
>self-contained program that exhibits the problem.

FYI, github gists are a great way to share a small piece of code like
this.

Or even better, a link to an example in compiler explorer.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Richard

unread,
Apr 15, 2020, 12:39:43 PM4/15/20
to
[Please do not mail me a copy of your followup]

"Alf P. Steinbach" <alf.p.stein...@gmail.com> spake the secret code
<r75fdn$f2p$1...@dont-email.me> thusly:

>On 14.04.2020 22:18, Kenny McCormack wrote:
>> In article <r740lu$irv$1...@adenine.netfront.net>,
>> Juha Nieminen <nos...@thanks.invalid> wrote:
>>> Bob Langelaan <bobl...@gmail.com> wrote:
>>>> This code used to work in earlier version of MS VS 2019:
>>>
>>> I'm somewhat certain that Visual Studio engineers don't read this newsgroup.
>>> You should report this through the proper Microsoft channels.
>>
>> Where it will go directly to /dev/null.
>
>That's not my experience.

It depends on what kind of bugs you file. I've filed many bugs that
get sent to some QA team in China that is clearly being measured by
how many bugs they close, not how many issues are resolved to the
customer's satisfaction. They are very quick to say "can't reproduce,
close" and they don't even follow the reproducing steps I write in the
bug.

This was my experience in the last few years; perhaps recently they've
improved the situation. I still file bugs, but I don't expect them to
get fixed.

Keith Thompson

unread,
Apr 15, 2020, 4:23:46 PM4/15/20
to
legaliz...@mail.xmission.com (Richard) writes:
> Keith Thompson <Keith.S.T...@gmail.com> spake the secret code
> <87zhbfi...@nosuchdomain.example.com> thusly:
>>But the most helpful thing you could provide is a complete
>>self-contained program that exhibits the problem.
>
> FYI, github gists are a great way to share a small piece of code like
> this.
>
> Or even better, a link to an example in compiler explorer.

Sure, but in this particular case the code snippet was short enough
that I expect a full example would reasonably fit into a post.
A link to a web site might not necessarily outlive the article.
0 new messages