https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170
--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> --- void __cond_swap(double* __x, double* __y) { bool __r = (*__x < *__y); *__x = __r ? *__y : *__x ; } void __cond_swap1(double* __x, double* __y) { bool __r = (*__x < *__y); *__y = __r ? *__x : *__y; } Separately, GCC can generate both max/min.