This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71753] Clamp function does not work with O3 optimization
- From: "lukasz.spintzyk at displaylink dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 04 Jul 2016 10:12:24 +0000
- Subject: [Bug c++/71753] Clamp function does not work with O3 optimization
- Auto-submitted: auto-generated
- References: <bug-71753-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #4 from Łukasz Spintzyk <lukasz.spintzyk at displaylink dot com> ---
Yes, this code is utilizing overflow, but it is there for a reason to optimize
the code and get rid of branches as they can slow down program execution.
You can refer to http://locklessinc.com/articles/sat_arithmetic/
Looking from this point of view is this really invalid?