Hacker News new | past | comments | ask | show | jobs | submit login

> aggressive ["]optimization[" ...] exploiting undefined behavior

That's still a compiler bug.

But yes, this is a bug in GCC and the title should show that.




Exploiting undefined behavior is something compilers can and will do; that's not a bug. (Specifically, if a compiler can choose to omit code where it can prove that going down that branch would lead to undefined behavior. That's not what happened here.)


To be clear, it's a bug for code to exploit undefined behavior.

A compiler may exploit the assumption that source code does not invoke undefined behavior.


Comparing a pointer to null isn't UB. De-referencing invalid pointers is ub.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: