When ginbulkdelete gets called for the first time in a VACUUM(i.e. stats == NULL), one of the first things it does is call ginInsertCleanup to get rid of the pending list. It does this in lieu of vacuuming the pending list.
This is important because if there are any dead tids still in the Pending list, someone else could come along during the vacuum and post the dead tids into a part of the index that VACUUM has already passed over.
The potential bug is that ginInsertCleanup exits early (ginfast.c lines 796, 860, 898) if it detects that someone else is cleaning up the pending list, without waiting for that someone else to finish the job.
Isn't this a problem?
Cheers,
Jeff