SDCC has the best OSS 8051 compiler. It is buggy as hell, but it is free. Sometimes that is good enough.
I used it for some toy projects never ran into "bugs" as in this is just broken, but it's quirky for sure.
What a coincidence, just yesterday I asked an LLM to generate a C compiler for the 8051 because SDCC's output was not optimized. Within an 1.5 hour it was correctly compiling my project at 60% of the size of what SDCC generates. One or 2 quota refreshes later it passed the SDCC test suite and optimized soft floats.
I used sdcc for an 8051 based commercial project a while back. I seem to remember spending more time reading the assembly to figure out workarounds for the compiler than actually writing C code!
Whereas sdcc works brilliantly for z80 lineage processors. I wrote quite a lot of C for Gameboy recently and didn't find a single compiler bug in sdcc which revised my opinion of it upwards greatly.