Jump to content

systemc 2.3.3 member access within misaligned address error


Recommended Posts

Posted

SystemC 2.3.3 memory access error. Not sure where to report systemc bugs(possibly)

How to reproduce: a simple helloworld.cpp  build with `g++ -std=c++17 -D_GLIBCXX_DEBUG
-fsanitizer=address,undefined` (g++ is 9.3.0 on ubuntu 20.04 64bit), it will reliably produce below errors(without the `-D_GLIBCXX_DEBUG -fsanitize=address,undefined` the code runs with no errors). I build systemc and helloworld.cpp always with the same compiler flags to make sure they match.

```

../../src/sysc/kernel/sc_method_process.h:286:30: runtime error: member access within misaligned address 0x0000000000db
for type 'struct sc_method_process', which requires 8 byte alignment
0x0000000000db: note: pointer points here
<memory cannot be printed>

 

AddressSanitizer:DEADLYSIGNAL
=================================================================
==675211==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000db (pc 0x7f20df8a61e4 bp 0x7ffca9d82c10 sp 0x7ffc
a9d82bc0 T0)                                                                                                             
==675211==The signal is caused by a READ memory access.                                                                  
==675211==Hint: address points to the zero page.
   #0 0x7f20df8a61e3 in sc_core::sc_method_process::next_runnable() ../../src/sysc/kernel/sc_method_process.h:286
   #1 0x7f20df8a61e3 in sc_core::sc_runnable::push_front_method(sc_core::sc_method_process*) ../../src/sysc/kernel/sc_r
unnable_int.h:232
   #2 0x7f20df8a61e3 in sc_core::sc_simcontext::push_runnable_method_front(sc_core::sc_method_process*) ../../src/sysc/
kernel/sc_simcontext_int.h:227
   #3 0x7f20df8a61e3 in sc_core::sc_simcontext::prepare_to_simulate() kernel/sc_simcontext.cpp:744
   #4 0x7f20df8a9a84 in sc_core::sc_simcontext::initialize(bool) kernel/sc_simcontext.cpp:819
   #5 0x7f20df8aabdd in sc_core::sc_simcontext::simulate(sc_core::sc_time const&) kernel/sc_simcontext.cpp:844
   #6 0x7f20df8ad5c4 in sc_core::sc_start(sc_core::sc_time const&, sc_core::sc_starvation_policy) kernel/sc_simcontext.
cpp:1718
   #7 0x7f20df8ae219 in sc_core::sc_start() kernel/sc_simcontext.cpp:1752
   #8 0x55e06041f9c7 in sc_main /home/xxo/devel/notes/xcoding/verilog.systemc/systemc/hello/main.cxx:14
   #9 0x7f20df74f700 in sc_elab_and_sim kernel/sc_main_main.cpp:89
   #10 0x7f20df74ab8e in main kernel/sc_main.cpp:36
   #11 0x7f20dd329564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)
   #12 0x55e06041964d in _start (/home/xxo/devel/notes/xcoding/verilog.systemc/systemc/hello/debug.out+0x1064d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../src/sysc/kernel/sc_method_process.h:286 in sc_core::sc_method_process::next_runnab
le()

```
 

  • 4 weeks later...
Posted
#include "systemc"

using namespace sc_core;

class Hello : public sc_module {
  public:
    SC_HAS_PROCESS(Hello);
    explicit Hello(sc_module_name name_) : sc_module(name_) {}
    void say_Hello() { std::cout << "Hello World!" << std::endl; }
};

int sc_main(int argc, char* argv[]) {
    Hello h("Hello");
    h.say_Hello();
    return 0;
}

 

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...