brintos

brintos / llvm-project-archived public Read only

0
0
Text · 739 B · 16ebeda Raw
29 lines · c
1// RUN: %clang -O0 %s -o %t && %env_tool_opts=allocator_may_return_null=1:hard_rss_limit_mb=50:quarantine_size_mb=1 %run %t2 3#include <stdlib.h>4#include <stdio.h>5 6// https://github.com/google/sanitizers/issues/9817// UNSUPPORTED: android-268 9// FIXME: Hangs.10// UNSUPPORTED: tsan11 12// Hwasan requires tagging of new allocations, so needs RSS for shadow.13// UNSUPPORTED: hwasan14 15// FIXME: Something wrong with MADV_FREE or MAP_NORESERVE there.16// UNSUPPORTED: target={{.*solaris.*}}17 18void *p;19 20int main(int argc, char **argv) {21  for (int i = 0; i < sizeof(void *) * 8; ++i) {22    // Calloc avoids MSAN shadow poisoning.23    p = calloc(1ull << i, 1);24    fprintf(stderr, "%d %llu: %p\n", i, (1ull << i), p);25    free(p);26  }27  return 0;28}29