brintos

brintos / llvm-project-archived public Read only

0
0
Text · 802 B · d48f2c9 Raw
24 lines · cpp
1// RUN: %clangxx_scudo %s -o %t2// RUN: rm -rf %t-dir/random_shuffle_tmp_dir3// RUN: mkdir -p %t-dir/random_shuffle_tmp_dir4// RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out15// RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out26// RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out17// RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out28// RUN: not diff %t-dir/random_shuffle_tmp_dir/out?9// RUN: rm -rf %t-dir/random_shuffle_tmp_dir10 11// Tests that the allocator shuffles the chunks before returning to the user.12 13#include <stdio.h>14#include <stdlib.h>15 16int main(int argc, char **argv) {17  int alloc_size = argc == 2 ? atoi(argv[1]) : 100;18  char *base = new char[alloc_size];19  for (int i = 0; i < 20; i++) {20    char *p = new char[alloc_size];21    printf("%zd\n", base - p);22  }23}24