We've done this before in a long previous thread - stuff like optimisation detecting loop structures and replacing them with e.g. calls to memcpy. In embedded, there can be reasons why that is not desired. The hacks to prevent this are not always obvious. One such:
https://www.eevblog.com/forum/programming/gcc-arm32-compiler-too-clever-or-not-clever-enough/msg4121254/#msg4121254The case of losing most of your code because you are not referencing main() anywhere (but instead locating it as a given address and jumping to it e.g. from a boot loader) is comical, and has comical work-arounds like inserting main() into an unused vector table location, which is asm code and asm never gets optimised.
What I don't like is successive compiler versions introducing new warnings, or changing the default settings for warnings. That creates work which you do not need if you have a working product which you are shipping! And since GCC is a continuously moving target, you cannot possibly - in any real-world business environment - chase the latest version for ever. At some point you have to freeze the tools (unless your employer is stupid and just keeps paying you for unproductive work). I use Cube IDE and froze it at 1.14.1, GCC v11, and that's it. I have not seen
any advantage of any later version. But then I own my business, have done so since 1978, and have to run appropriate priorities, and while chasing new warnings would put bread on the table of an employee, it won't do so for me

Same goes for any modules like LWIP, MBEDTLS, you name it. All are moving targets. Often, like with MbedTLS (yes I am on their mailing list), they move mostly sideways, because the devs have run out of genuinely useful things to do, or they live in the standard "internet security groupthink" and don't actually build real products.
The real world is not perfect, no coder is perfect, and any significant chunk of code may have some UB, and a working product is relying on that being compiled in a certain way. Reality has no room for purists

So whatever tools works for you, use it...
The gotchas are
- will it run under later versions of windows (I address that using VMWARE, and run some c. 1995 tools that way)
- will it support later CPUs (probably no solution for that one)
and the drift in software is for floating licenses and such, which makes archiving a project nearly impossible. In the 1990s they used dongles which have the same problem (they eventually break) but patching them out was usually easy.