*/
if ((--callee->P_NRCALLED) == 0 &&
- (callee->p_flags1 & PF_EXTERNAL) == 0 &&
+ (complete_program || (callee->p_flags1 & PF_EXTERNAL) == 0) &&
(callee->p_flags1 & PF_LPI) == 0) {
DISPENSABLE(callee);
OUTTRACE("procedure %d can be removed",callee->p_id);
} else {
if (c->cl_proc->P_NRCALLED == 1 &&
!IS_CHANGED(c->cl_proc) &&
- (c->cl_proc->p_flags1 & PF_EXTERNAL) == 0 &&
+ (complete_program ||
+ (c->cl_proc->p_flags1 & PF_EXTERNAL) == 0) &&
(c->cl_proc->p_flags1 & PF_LPI) == 0) {
c->cl_proc->P_NRCALLED = 0;
SELECTED(c);