| 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 %t |
| 2 | |
| 3 | #include <stdlib.h> |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | // https://github.com/google/sanitizers/issues/981 |
| 7 | // UNSUPPORTED: android-26 |
| 8 | |
| 9 | // FIXME: Hangs. |
| 10 | // UNSUPPORTED: tsan |
| 11 | |
| 12 | // Hwasan requires tagging of new allocations, so needs RSS for shadow. |
| 13 | // UNSUPPORTED: hwasan |
| 14 | |
| 15 | // FIXME: Something wrong with MADV_FREE or MAP_NORESERVE there. |
| 16 | // UNSUPPORTED: target={{.*solaris.*}} |
| 17 | |
| 18 | void *p; |
| 19 | |
| 20 | int main(int argc, char **argv) { |
| 21 | for (int i = 0; i < sizeof(void *) * 8; ++i) { |
| 22 | // Calloc avoids MSAN shadow poisoning. |
| 23 | p = calloc(nmemb: 1ull << i, size: 1); |
| 24 | fprintf(stderr, format: "%d %llu: %p\n" , i, (1ull << i), p); |
| 25 | free(ptr: p); |
| 26 | } |
| 27 | return 0; |
| 28 | } |
| 29 | |