Let's dissect the code:
void ProcessSercom0Word(unsigned int Sercom0Word)
{
PrtCntrlBrdCommands PrtCntrCmd;
PrtCntrCmd = (PrtCntrlBrdCommands)(( Sercom0Word & 0xf000) >> 12);
That fourth line is not a function call, but a cast. The part in the right-side parentheses takes bits 12..15 of Sercom0Word and shifts them down 12 bits, then casts the result to PrtCntrlBrdCommands type (values 0 to 15, inclusive).
If the rest of the code in the function does not use PrtCntrCmd, the compiler is free to omit the variable and the computation altogether.
dummyglobal = PrtCntrCmd;
i.e. assigning its value to a global variable is just one way to tell the compiler the value is required.
If the rest of the function is basically
switch (PrtCntrCmd) {
case 0: break;
case 1: break;
case 2: break;
case 3: break;
case 4: break;
case 5: break;
case 6: break;
case 7: break;
case 8: break;
case 9: break;
case 10: break;
case 11: break;
case 12: break;
case 13: break;
case 14: break;
case 15: break;
}
}
it does nothing, and definitely does not cause the program to hang.
However, it looks like this has something to do with SPI and interrupts. They don't just magically work, with "doing something" "fixing issues". No, the problematic version of the function simply did not do what you intended it to do.
Edited: I forgot, this is SAMD20. So:
On SAMD20, REG_SERCOM0_SPI_INTFLAG refers to the SPI interrupt status flag and clear register. A function handling the SPI interrupt must clear the status flag, by writing a value with bits set for the interrupt causes it has handled (see chapter 25.6.2.6 in the SAM D20 Family Data Sheet). If it does not do so, the same interrupt is raised immediately after the function returns. Then, the only thing running on the microcontroller is that interrupt handler function (and any higher-priority interrupts that might occur at the same time). The SAMD20 is not stuck or hung; it is doing exactly what you have instructed it to do, repeatedly calling that interrupt handler without allowing anything else to run (except other interrupts with same or higher priority).