The docs for copyFunction do not specify what is the behavior of this function when computeCFGInfo has been called on the given fundec. I have preemptively looked into copyFunction's definition and it seems that this case is not handled, vstmt does not touch succs nor preds. This could break the stated invariant that
There should be no sharing between the copy and the original function
The fix should be relatively easy, we need to patch the succs and preds fields of each statement in a similar way as it is done for goto and switch. Something like
The docs for
copyFunction
do not specify what is the behavior of this function whencomputeCFGInfo
has been called on the givenfundec
. I have preemptively looked intocopyFunction
's definition and it seems that this case is not handled,vstmt
does not touchsuccs
norpreds
. This could break the stated invariant thatThe fix should be relatively easy, we need to patch the
succs
andpreds
fields of each statement in a similar way as it is done forgoto
andswitch
. Something likeShould I?
Warning: I have not yet tried to copy a
fundec
after computing CFG info. I report this issue based on my sole understanding of the code.Thanks!