When an omp for loop is canceled the constructed objects are being destructed twice.
It looks like the desired code is:
{
Obj o; If (cancelled) branch-through-cleanups to cancel.exit.
}
[cleanups]
cancel.exit:
__kmpc_for_static_fini br cancel.cont (*)
cancel.cont:
__kmpc_barrier return
The problem seems to be the branch to cancel.cont is currently also going through the cleanups calling them again. This change just does a direct branch instead.