[Bug c++/71753] Clamp function does not work with O3 optimization

2016-07-04 Thread lukasz.spintzyk at displaylink dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753 --- Comment #6 from Łukasz Spintzyk --- I confirm changing the code to use unsigned int fixed the problem. Also there is no signed overflow errors. Thanks a lot.

[Bug c++/71753] Clamp function does not work with O3 optimization

2016-07-04 Thread lukasz.spintzyk at displaylink dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753 --- Comment #4 from Łukasz Spintzyk --- 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

[Bug c++/71753] New: Clamp function does not work with O3 optimization

2016-07-04 Thread lukasz.spintzyk at displaylink dot com
: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lukasz.spintzyk at displaylink dot com Target Milestone: --- Created attachment 38830 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38830&action=edit Code that reproduces the issue Hi, The issue is that