[llvm-dev] RFC: Extend UBSan with qsort checks

Yuri Gribov via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 14 01:51:18 PST 2016


On Thu, Jan 14, 2016 at 10:06 AM, Paul Pluzhnikov
<ppluzhnikov at google.com> wrote:
> On Wed, Jan 13, 2016 at 10:37 PM, Yuri Gribov <tetra2005 at gmail.com> wrote:
>
>> I'm afraid it's even N^3 (with N=32 cap). This indeed sounds scary but
>> I have not seen significant slowdowns when running instrumented
>> distro.
>
> Have you looked at how many sort invocations there are, and what their
> size distribution is?
>
> Perhaps naively, I expect very few sort()s to be performed in day to
> day distro operation, and even fewer sort()s with more than 20
> elements.

That's my feeling as well but I never had time to really profile this.

>> Right, I thought about improving this with testing random 32 elements
>> instead of the first ones.
>
> That has its own disadvantages: it makes the failure detection
> non-repeatable, and makes it harder to understand the conditions under
> which the predicate is broken.

Absolutely (although could be mitigated by printing the seed together
with error message).

> --
> Paul Pluzhnikov


More information about the llvm-dev mailing list