Has anyone defined a strict subset of C to be used as target for compilers? Or ideally a more regular and simpler language, as writing a C compiler itself is fraught with pitfalls.
Sounds like why LLVM was created? (and derivatives like MLIR and NaCL) Its IR is intended be be C-like, except that everything is well-defined and substantially more expressive than C.
https://en.wikipedia.org/wiki/C-- for example?
I think one could also use a subset compatible with a formal semantics of C. Maybe the C semantics in K Framework, CompCert C, or C0 from Verisoft. Alternatively, whatever is supported in open-source, verification tooling.
Then, we have both a precise semantics and tools to help produce robust output.
For portability, hopefully C89 as well?
Not precisely, but C-- (hard to search for!) was a C-like (or C subset?) intermediate language for compilers to generate.
I found this Reddit thread that gives a bit more detail:
https://www.reddit.com/r/haskell/comments/1pbbon/c_as_a_proj...
and the project link:
https://www.cs.tufts.edu/~nr/c--/