logoalt Hacker News

fjfaasetoday at 12:14 AM1 replyview on HN

The code of TCC (0.9.26) is kind hard to compile, I have discovered in the past year, while developing a minimal C compiler to compile the TCC sources [1]. For that reason, I have concluded that TCC is its own test set. It uses the constant 0x80000000, which is an edge case for if you want to print it as a signed integer only using 32-bit operators. There is a switch statement with an post-increment operator in the switch expression. There are also switch statements with fall throughs and with goto statements in the cases. It uses the ## operator where the result is the name of a macro. Just to name a few.

[1] https://github.com/FransFaase/MES-replacement


Replies

ForOldHacktoday at 1:44 AM

You have simply made one tiny step, that the guys who used AI and $25,000 to write a C compiler in Rust, could not make:

You are using the compiler to compile itself.

"TCC is its own test set." Absolutely brilliant.

show 1 reply