Home | History | Annotate | Download | only in Linux
      1 // RUN: %clangxx_asan -O0 %s -fsanitize-address-zero-base-shadow -pie -o %t && %t 2>&1 | FileCheck %s
      2 
      3 // Zero-base shadow only works on x86_64 and i386.
      4 // REQUIRES: x86_64-supported-target
      5 
      6 // A regression test for time(NULL), which caused ASan to crash in the
      7 // zero-based shadow mode on Linux.
      8 // FIXME: this test does not work on Darwin, because the code pages of the
      9 // executable interleave with the zero-based shadow.
     10 
     11 #include <stdio.h>
     12 #include <stdlib.h>
     13 #include <time.h>
     14 
     15 int main() {
     16   time_t t = time(NULL);
     17   fprintf(stderr, "Time: %s\n", ctime(&t));  // NOLINT
     18   // CHECK: {{Time: .* .* .*}}
     19   return 0;
     20 }
     21