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