Hi! Custom OS dev is cool! I wonder, what are your thoughts on compilers?

Questions, comments, and suggestions about this site should go here.
ell1e
Posts: 9
Joined: Thu Aug 07, 2025 4:30 pm
Contact:

Re: Hi! Custom OS dev is cool! I wonder, what are your thoughts on compilers?

Post by ell1e »

I've never seen a compiler written directly in assembly, that's so fascinating! I wonder, is there some C code example for a code snippet that a C compiler would commonly optimize wrongly?

I'm still lurking and hoping for a compiler subforum if one were to ever show up O:) i'm currently working on a pair of two languages using the same shared compiler, but nothing's really in a super usable state yet. I hope to have an alpha working in a month or two.
User avatar
Demindiro
Member
Member
Posts: 165
Joined: Fri Jun 11, 2021 6:02 am
Libera.chat IRC: demindiro
Location: Belgium
Contact:

Re: Hi! Custom OS dev is cool! I wonder, what are your thoughts on compilers?

Post by Demindiro »

ell1e wrote: Fri Dec 05, 2025 10:28 am I wonder, is there some C code example for a code snippet that a C compiler would commonly optimize wrongly?
I don't have a concrete example at hand, as most code is fairly typical and a lot of bugs in mainstream compilers (GCC/Clang) get ironed out by essentially bruteforce due to how widely they are used.
Where potential issues lurk is in atypical code which may trigger paths that haven't been extensively tested. One notorious example is LLVM's noalias attribute, which Rust repeatedly tried to use yet had to disable frequently as Rust is the first mainstream language to make extensive use of it. (Though last I heard no further issues have been found).
GeneSYS exokernel (Codeberg)
Lemmings! micro-/multikernel (Github, Codeberg)
Waddle container tool (Codeberg)
ell1e
Posts: 9
Joined: Thu Aug 07, 2025 4:30 pm
Contact:

Re: Hi! Custom OS dev is cool! I wonder, what are your thoughts on compilers?

Post by ell1e »

Huh! I find it curious you would go so far to avoid that potential issue. But I admit I didn't ever really check if a compiler optimized something wrongly, so I don't know how prevalent that is.
Post Reply