Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Posix / qsort.cpp
blobf2b90c47a3d5cfa758cf07283556e9d948ff7578
1 // RUN: %clangxx -O2 %s -o %t
3 #include <algorithm>
4 #include <assert.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <vector>
9 static int compare_ints(const void *a, const void *b) {
10 return *(const int *)b - *(const int *)a;
13 int main() {
14 std::vector<int> nums(100000);
15 for (auto &n : nums)
16 n = rand();
18 std::vector<int> to_qsort = nums;
19 qsort(to_qsort.data(), to_qsort.size(), sizeof(to_qsort[0]), &compare_ints);
21 std::sort(nums.begin(), nums.end());
23 assert(nums == to_qsort);