This question has an employee with two different employers, each employer fully knowing the situation, and each contract has a clause telling that all the software produced by the employee (even outside work hours) belongs to each of the employer.
Now, the employee wondered if he had signed himself in a position were he could be forced to give one of his employers something that the employee did not own (the code he did working for the other employer).
Common sense would tell that each of the employers know that the employee does not own the code he is producing for the other employer, so they cannot ask him to give something that is not his to give. And since they knew about this limitation at the moment of signing/giving permission to get a second job, does that mind that they lose their right to pretend ownership of the other employer's code? Is this situation codified in some law term?