Skip to content

Commit

Permalink
[HWASan] Move LTO test to separate file.
Browse files Browse the repository at this point in the history
The test fails on Android for an unknown reason but is still worth
having for x86.
  • Loading branch information
morehouse committed Nov 22, 2021
1 parent 91f78eb commit 615ecd8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 0 additions & 4 deletions compiler-rt/test/hwasan/TestCases/global.c
Expand Up @@ -5,10 +5,6 @@
// RUN: not %run %t -1 2>&1 | FileCheck --check-prefixes=CHECK,LSYM %s
// RUN: not %env_hwasan_opts=symbolize=0 %run %t -1 2>&1 | FileCheck --check-prefixes=CHECK,LNOSYM %s

// Test with LTO, since it invokes the integrated assembler separately.
// RUN: %clang_hwasan -flto %s -o %t
// RUN: not %run %t 1 2>&1 | FileCheck --check-prefixes=CHECK,RSYM %s

// Test with and without optimizations, with and without PIC, since different
// backend passes run depending on these flags.
// RUN: %clang_hwasan -fno-pic %s -o %t
Expand Down
17 changes: 17 additions & 0 deletions compiler-rt/test/hwasan/TestCases/lto.c
@@ -0,0 +1,17 @@
// Test globals with LTO, since it invokes the integrated assembler separately.
// RUN: %clang_hwasan -flto %s -o %t
// RUN: not %run %t 1 2>&1 | FileCheck %s

// REQUIRES: pointer-tagging
// UNSUPPORTED: android

#include <stdlib.h>

int x = 1;

int main(int argc, char **argv) {
// CHECK: Cause: global-overflow
// CHECK: is located 0 bytes to the right of 4-byte global variable x {{.*}} in {{.*}}lto.c.tmp
// CHECK-NOT: can not describe
(&x)[atoi(argv[1])] = 1;
}

0 comments on commit 615ecd8

Please sign in to comment.