https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88575
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Sat, 22 Dec 2018, bugzi...@poradnik-webmastera.com wrote: > In test() gcc is not able to determine that for a==b it does not have to > evaluate 2nd comparison and can use value of a if 1st comparison is true. When > operators are swapped like in test2() or are the same, code is optimized. > > [code] > double test(double a, double b) > { > if (a <= b) > return a < b ? a : b; > return 0.0; > } You didn't give compilation options, but if a and b are +0 and -0 in some order, the first comparison is true but b must be returned instead of a (in the absence of -fno-signed-zeros or an option implying it).