-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Segmentation fault error during federated execution caused by multiport #25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a little question/quibble, but basically I am just happy that it works now. Thank you Jacky! this might have saved me a ton of time.
generic_port_instance_struct* cport = (generic_port_instance_struct *)port; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the intended design was to keep this as-is, and to wrap line 433 (FEDERATED_ASSIGN_FIELDS
) in if (width == -2)
. Just guessing since it seems like cport
is only being used when the port is not a multiport.
In fact it might have been clearer to move all of the code that touches cport
into the branch at line 435-448.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Peter here. The proposed cast doesn't look correct for a multiport, and, although it is probably harmless, it seems misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good diagnosis! I agree with @petervdonovan that there may be a slightly better fix.
generic_port_instance_struct* cport = (generic_port_instance_struct *)port; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Peter here. The proposed cast doesn't look correct for a multiport, and, although it is probably harmless, it seems misleading.
@petervdonovan, if you could implement your suggested change and file a PR in reactor-c, that would be great! |
Closing as replaced by lf-lang/reactor-c#218 |
This pull request addresses the issue found in the
convert_C_port_to_py
function. The problem occurs when handlinggeneric_port_instance_struct* cport
for multiport instances. Currently, this structure is not properly assigned when dealing with multiport instances, which leads to subsequent issues in the function. On line 433, we see the macroFEDERATED_ASSIGN_FIELDS(((generic_port_capsule_struct*)cap), cport)
, which relies on cport. In the case of multiport, if cport isn't appropriately assigned, this macro won't function correctly, causing segmentation fault.