Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3244644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:34:33+00:00 2026-05-17T18:34:33+00:00

The program below crashes when I build it in Release x64 (all other configurations

  • 0

The program below crashes when I build it in Release x64 (all other configurations run fine).

Am I doing it wrong or is it an OpenMP issue?
Well-grounded workarounds are highly appreciated.

To reproduce build a project (console application) with the code below.
Build with /openmp and /GL and (/O1 or /O2 or /Ox) options in Release x64 configuration.
That is OpenMP support and C++ optimization must be turned on. The resulting program should (should not) crash.

#include <omp.h>
#include <vector>

class EmptyClass
  {
  public:
    EmptyClass() {}
  };

class SuperEdge
  {
  public:
    SuperEdge() {mp_points[0] = NULL; mp_points[1] = NULL;}

  private:
    const int* mp_points[2];
  };

EmptyClass CreateEmptyClass(SuperEdge s)
  {
  return EmptyClass();
  }

int main(int argc, wchar_t* argv[], wchar_t* envp[])
  {
  std::vector<int> v;
  long count = 1000000;

  SuperEdge edge;
  #pragma omp parallel for 
  for(long i = 0; i < count; ++i)
    {
    EmptyClass p = CreateEmptyClass(edge);
    #pragma omp critical
       {
       v.push_back(0);
       }
    }

  return 0;
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:34:34+00:00Added an answer on May 17, 2026 at 6:34 pm

    I think it is a bug. Looking at the ASM output with /O2 on the push_back call has been optimized away and there are just a couple of reserve calls and what looks like direct accesses instead. The reserve calls however don’t appear to be in the critical section and you end up with Heap corruption. Doing a release x64 with /openmp /GL /Od you will see that there is a call to push_back in the asm, and it is between the _vcomp_enter_critsect calls, and doesn’t crash. I’d report it to MS. (tested with VS 2010)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The example program below compiles two in-memory assemblies. The first compilation works fine. The
I am using the program below to sort and eventually print out email messages.
In the program below, there are two things that I don't understand. How can
In the below program: class Main { static string staticVariable = Static Variable; string
I have seen many programs consisting of structures like the one below typedef struct
Program followed by output. Someone please explain to me why 10,000,000 milliseconds from Jan
Most program languages have some kind of exception handling; some languages have return codes,
My program generates relatively simple PDF documents on request, but I'm having trouble with
A program receives a list of Messages (base type). Each message in the list
My Program overrides public void paint(Graphics g, int x, int y); in order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.