I have an application calling stable_sort with a comparison operator. stable_sort internally calls __stable_sort_adaptive __merge_sort_with_buffer __merge_sort_loop _GLIBCXX_STD_P::merge The last function (if called directly) requires the parameters to be sorted. It seems to me that this is not necessarily the case here.
Created attachment 15685 [details] Source code illustrating the problem
Will investigate ASAP, note this is not a regression, already fails at least with 4.1.3...
Out of interest, how did you come across this comparison operator? You comparison operator fails to be an ordering, in particular it is required that: comp(a,b) && comp(b,c) implies comp(a,c) comp(0x8ac6a30, 0x8ac69e4) and comp(0x8ac69e4, 0x8ac6ac8) are both true, but comp(0x8ac6a30, 0x8ac6ac8) is false.
It's *extremely* unlikely that stable_sort, unchanged for many years, is misusing merge. Therefore, before any further investigation, please provide a testcase involving a well-formed comparison operator.
Bug was on my side, the comparison operator didn't form a total order. Sorry for the noise.
Works fine