Jump to content

bug in sc_reset::reconcile_resets()


shunning

Recommended Posts

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

 

Link to post
Share on other sites

Hi Shunning,

 

Thanks for your report. I agree with you, the head of the linked list should be set to NULL after the loop.

 

The reset of the sim context is indeed an undefined behaviour, but programmatically speaking, it should be set to NULL. I will forward that.

 

Thanks,

 

Guillaume

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...