It would have been really helpful if you had said that to start with.
If vPortPendSVHandler() was not the first thing to execute on interrupt
entry then I’m surprised it worked at all as that is the function that
performs the switch from one task to another - that means it must save a
task’s context exactly as it was when the interrupt was entered, and
performing any processing in between entering the interrupt and saving
the context that changes the context will be problematic when the task
next runs.
xPortPendSVHandler() saves the context of the task that was interrupted
the context being (in part) the values held in CPU registers.
Entering PendSV_Handler() will change the register values before
xPortPendSVHandler() is executed, with the possibility that the register
values saved within xPortPendSVHandler() are already corrupt.
When you use floating point instructions a bit gets set in one of the
control registers, which in turn changes the stack frame when you enter
interrupts. I would have to study the code output by the compiler to
see exactly why you were getting the symptoms you were, but it is likely
you actually have a problem in all cases but were only noticing when the
stack frame was different and/or when floating point registers
corruptions were causing faults.