Nowadays, I use at function to access vector and it out of range. However, it didn't pause and the program shutdown only.
#include <systemc>
int sc_main(int args, char* argv[])
{
std::vector<int> vec = {1, 2, 3};
int num1 = vec.at(1);
int num2 = vec.at(10);
return 0;
}
Here's the result:
root@xxx:/home#
SystemC 2.3.3-Accellera --- Jan 25 2024 15:41:45
Copyright (c) 1996-2018 by all Contributors,
ALL RIGHTS RESERVED
Error: (E549) uncaught exception: vector::_M_range_check: __n (which is 10) >= this->size() (which is 3)
In file: ../../../src/sysc/kernel/sc_except.cpp:101
root@xxx:/home#
I expected it will be like below, and the program will be crash and output coredump file.
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 10) >= this->size() (which is 3)