LTO is not perfect and also the optimizer although it‘s getting better and better.
I think it‘s not a FreeRTOS bug and rather an issue with the (pretty aggressive) -O3 in combination with LTO.
BTW I’m using -Os for MCU applications running from rather slow flash to minimize the amount of code to be fetched and GCC __attribute__ to optimize certain functions differently. -O3 produces larger code.
I had rare issues even with -Os workarounded/patched myself. Unfortunately it’s a bit try and error.
You could also try to update your GCC toolchain to GCC10-2020-q4. Maybe it helps.
Edit: I think adding portDONT_DISCARD to pxCurrentTCB won’t help. It’s volatile anyway. The optimized calling function is likely the problem where you could try to apply a dedicated attribute or whatever it takes.
Some kind of magic with this error. It went by itself after further refining my source code, even when I removed portDONT_DISCARD before pxCurrentTCB declaration))