Hacker News new | ask | show | jobs
by justincormack 4707 days ago
For an example of a recent bug try this http://gcc.gnu.org/bugzilla//show_bug.cgi?id=56888 basically the compiler tries to recognise code that manually does memcpy or memcmp and replaces it with the built in version. Even if you are trying to compile libc where you get an infinite loop when this happens.
2 comments

My colleagues and I often lament how gcc is just so much smarter than all of us. Usually after spending a day figuring out why our code wasn't working, only to discover that gcc was doing something "clever".
This one sounds almost like peephole optimization of sorts. How exactly is that "clever"?
I assumed it was the ironic sense—it was intended to be clever but just ended up being a bug.
It does this for very good reason of course. If you are trying to build a C library, you already have freestanding issues, this is nothing new.
Not sure I follow your comment. This is with -ffreestanding, how are you supposed to compile libc?