As written, you "main" code passes the semaphore part, then enter an endless loop transmitting more or less random values from array[index] while incrementing index in both the interrupt and the main. It would be challenging to find conditions where it doesn't fail.
It is also not great conceptually. Your interrupt code should push the message into FIFO, your main code should check if there's a message in FIFO, and if it is, pull it out of there. That's all. FIFO must be large enough to hold all messages at all times. The required size may be calculated based on the worst case scenario.
local_array (which BTW is not used in your code) doesn't add anything useful to the scheme.