@alilly To my knowledge, FreePascal has all the same footguns as GCC C, except viral Undefined Behaviour. (The optimisation philosophy is quite different: it doesn't seem to transform code into "equivalent code" in the same way, but often produces smaller binaries despite that.)
You could write your own language, and use that to write your operating system.