3 ms·
> changing -O2 to -O3 in gcc that ended in sporadic crashes when cross-compiling for 1 specific platform. Sure, this happens regularly in C and C++ because lar
by roca 6y ago
> changing -O2 to -O3 in gcc that ended in sporadic crashes when cross-compiling for 1 specific platform.
Sure, this happens regularly in C and C++ because large programs inevitably depend on undefined behaviour, and changing compiler versions, optimization levels and target platforms is allowed to change that behaviour.
For the last five years I've been writing 99% safe Rust code, which is designed to have no undefined behavior, and I think it's not a coincidence that I can't remember ever having a compiler update break code at runtime. Once in a long while a compiler update will fail to compile some existing code, but that's not a safety issue.
The idea that C and C++ compilers are somehow more stable across releases is a mirage.
https://lwn.net/Articles/845691/ https://lwn.net/Articles/845691/
https://lwn.net/Articles/845775/ https://lwn.net/Articles/845775/
- bluGill 6y agoNo, this happens because bugs in compilers happen. Nothing to do with undefined behavior. (Which is a separate problem)
- steveklabnik 6y agoIt can be both.