this post was submitted on 25 Apr 2025
18 points (100.0% liked)
Linux
7082 readers
993 users here now
A community for everything relating to the GNU/Linux operating system
Also check out:
Original icon base courtesy of [email protected] and The GIMP
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
or simply use a well designed programming language.
In a way that seems to be what the paper is showing evidence for. Basically they looked at what happens if you disable the optimizations the LLVM compiler does when it knows something is undefined (and thus should not appear in a well written program). And they claim to have found minimal performance regressions of which can largely be mitigated in other ways.
And that has been the biggest argument for having UB in C/C++ - to let the compilers optimize things in ways that you cannot do if everything was well defined. This might have been true in the past when we had a lot more variation in CPU designs but this paper seems to conclude that is no longer the case. Thus raises the question as to why do we need so much UB in C/C++ any more if performance is not a bit issue for modern programs using modern CPUs.