Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

bug in sc_reset::reconcile_resets()

$
0
0

I didn't find an efficient bug report entrance so I decided to post it here to see whether people think this is a bug or not.
 

I'm trying to use Ralph's solution to reset the sim context (see http://forums.accellera.org/topic/2273-problem-with-re-instatiation-of-modules/).

 

However, that only works well with those modules that don't have a reset signal. I spent some time debugging this with reset signal and found that:

 

This method, sc_reset::reconcile_resets() at src/sysc/kernelsc_reset.cpp:160, is supposed to iterate over all things in reset_finder_q, a static linked list of sc_reset_finder, and delete sc_reset_finder one by one (see line 168-170 for the nature of a linked list, line 195 for delete).

 

Here comes the bug: after the loop, it should but it forgot to set reset_finder_q to NULL!

 

If reset_finder_q is not NULL when I reset the sim context, the next reset signal at line 97 will append itself to a non-existing queue node, which makes the next reconcile_reset cast seg fault.

 

I could see that it's indeed undefined behavior to reset the sim context, but in general it is not a good idea to forget to reset some pointer.

 

 

Thanks,

Shunning

 


Viewing all articles
Browse latest Browse all 595

Trending Articles