Jump to content

Runtime exception when running SystemC 2.3.3 under MS Visual Studio 2019


Recommended Posts

Hi all,

I am running into a very weird exception when I try to build SystemC applications that contain `SC_THREAD` under Visual Studio 2019. I managed to prepare a small reproduction example (see attached file) which looks like:

#include <systemc>

SC_MODULE(Test) {
  SC_HAS_PROCESS(Test);

  explicit Test(sc_core::sc_module_name name)
      : sc_module(name) {
    SC_THREAD(busy);
  }

  void busy(void) {
    for(int i = 0; i < 10; i++) {
      sc_core::wait(1, sc_core::SC_NS);
      printf("busy\n");
    }
    sc_core::sc_stop();
  }
};

int sc_main(int, char *[]) {
  Test ttt("ttt");

  sc_core::sc_start();

  return EXIT_SUCCESS;
}

The program is compiled using the attached CMakeLists.txt file. Upon execution, it runs into an exception and when I look in the debugger, the exception comes from:

image.thumb.png.922f16ef8f671b409a3d389f815e0844.png

The same program runs without any issues when compiled using GCC 9.2 on CentOS 7. On Windows, I am using Windows 10 with VS 2019 Enterprise.
Did anyone else run into similar issues when trying SystemC 2.3.3 with VS 2019?

 

Edit 1: Issue has been resolved. It turns out that you need to pass `/GR` and  `/vmg` in the compile flags.

 

Best Regards,

Mohamed

CMakeLists.txt ctor.cc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...